diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9335a932 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:bookworm-slim + +RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg && apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN echo deb http://deb.debian.org/debian bookworm-backports main > /etc/apt/sources.list.d/backports.list +RUN apt-get update && \ + apt-get install -y --no-install-recommends apg bzip2 xz-utils ca-certificates golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports make git python3 && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN useradd -m --shell /bin/sh --home-dir /var/lib/aptly aptly + +RUN mkdir app +WORKDIR /app + +CMD /app/system/run-system-tests diff --git a/Makefile b/Makefile index f2c3468b..cd7b1951 100644 --- a/Makefile +++ b/Makefile @@ -82,4 +82,10 @@ man: version: @echo $(VERSION) -.PHONY: man modules version release goxc +docker-build: + docker build -f system/Dockerfile --no-cache . -t aptly-system-test + +docker-system-tests: + docker run --rm -it -v ${PWD}:/app aptly-system-test + +.PHONY: man modules version release goxc docker-build docker-system-tests diff --git a/system/run-system-tests b/system/run-system-tests new file mode 100755 index 00000000..3b564383 --- /dev/null +++ b/system/run-system-tests @@ -0,0 +1,13 @@ +#!/bin/sh + +rm -rf /tmp/aptly* +rm -rf /home/test/.* +rm -rf /home/test/aptly-fixture-* + +usermod -u `stat -c %u /app` aptly +chown -R `stat -c %u /app` /var/lib/aptly + +mkdir -p /home/runner +chown -R `stat -c %u /app` /home/runner + +exec su - aptly -c "cd /app; go mod tidy; HOME=/home/runner make system-test"