diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-05 13:30:07 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-05 13:32:27 +0100 |
| commit | 83f9bc5e1314c32422d4030763853e76fd56290c (patch) | |
| tree | ce5d3cbb24f34ce9817b42ed8f8f0c714bd9f441 /ci/docker/gotest.docker | |
| parent | 6f6c89eac6a6a5d036be4f2f826d8d96c1052b88 (diff) | |
CI: Support Podman as an alternative to Docker
Podman-compose (can be aliased to docker-compose now) does not have
the exact same options. We move the compose file to the root to
support podman. This is also better because users can just execute
docker-compose in the root.
Diffstat (limited to 'ci/docker/gotest.docker')
| -rw-r--r-- | ci/docker/gotest.docker | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ci/docker/gotest.docker b/ci/docker/gotest.docker new file mode 100644 index 0000000..ec98d0c --- /dev/null +++ b/ci/docker/gotest.docker @@ -0,0 +1,59 @@ +FROM debian:bullseye + +# This docker image is for testing the go code with go test and the needed dependencies for selenium + +WORKDIR /eduvpn + +# Dependencies +RUN apt-get update +RUN apt-get -y install openjdk-11-jre xvfb python3-selenium firefox-esr python3-pip wget + +# Install go from go.dev +# Get +RUN wget https://go.dev/dl/go1.19.4.linux-amd64.tar.gz -O go.tar.gz + +# Verify hash +RUN echo "c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8 go.tar.gz" | sha256sum --check + +# Untar +RUN tar -C /usr/local -xzf go.tar.gz + +# Update PATH +ENV PATH="/usr/local/go/bin:$PATH" + +# Install geckodriver and add to path +WORKDIR /eduvpn/vendor +RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz +RUN tar xzvf geckodriver-v0.30.0-linux64.tar.gz +ENV PATH="/eduvpn/vendor:$PATH" + +# Update certificates +COPY ./ci/docker/selfsigned/eduvpnserver.crt /usr/local/share/ca-certificates/eduvpnserver.crt +RUN update-ca-certificates + +# Run tests as a new user for pip +RUN useradd --create-home test +USER test + +WORKDIR /home/test + +# Copy sources with correct permissions +COPY --chown=test:test . ./ + +# Vendor go dependencies +RUN go mod vendor + +# Clean because there might be previous builds copied over +RUN make clean + +# Build go +RUN make build + +# Make python lib +RUN make -C wrappers/python + +# Install python lib +RUN pip3 install wrappers/python/dist/*.whl + +# Run the tests +CMD ["make", "test"] |
