Merge pull request 'Add Dockerfile to run tests in' (#676) from famfo/end-to-end:podman into main

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/676
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2025-06-07 11:19:51 +00:00
commit f8e06e4af8
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
3 changed files with 49 additions and 0 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
.git

40
Dockerfile Normal file
View file

@ -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

View file

@ -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.