diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..6b8710a7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7cf8242e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM code.forgejo.org/oci/node:20-bookworm + +ENV PATH=$PATH:/setup-forgejo +ENV _CONTAINERS_USERNS_CONFIGURED="" + +ADD https://code.forgejo.org/actions/setup-forgejo.git /setup-forgejo + +RUN apt-get update && \ + apt-get --assume-yes --no-install-recommends install \ + ca-certificates \ + curl \ + daemon \ + git \ + jq \ + podman \ + podman-docker \ + procps \ + slirp4netns \ + sqlite3 \ + sudo \ + tcpdump \ + uidmap \ + wget && \ + adduser forgejo-tests && \ + groupadd wheel && \ + adduser forgejo-tests wheel && \ + echo "%wheel ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers && \ + echo "forgejo-tests:10000:9999" > /etc/subuid && \ + echo "forgejo-tests:10000:9999" > /etc/subgid && \ + mkdir /srv/forgejo-binaries && \ + chown forgejo-tests:forgejo-tests /srv/forgejo-binaries && \ + apt-get clean + +COPY . /e2e + +USER forgejo-tests + +WORKDIR /e2e + +ENTRYPOINT /bin/bash diff --git a/README.md b/README.md index cdae346c..6efdc7b5 100644 --- a/README.md +++ b/README.md @@ -108,3 +108,11 @@ Cleanup. It will teardown the Forgejo instance. ```sh ./end-to-end.sh stop ``` + +## Running tests in Docker/Podman + +There is an included Dockerfile in which the tests can be run. Building the +conatiner will copy the the entire repo state into the container from which +changes to the tests can be tested. Note: running in podman requires the +`--privileged` flag because this will run podman in podman for some tests. +