summaryrefslogtreecommitdiff
path: root/ci/docker/go-test.docker
blob: 9ee0c9a1dad492dd7b9f961d4a58074bdcf16814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM golang:1.18

# This docker image is for testing the go code with go test and the needed dependencies for selenium

WORKDIR /eduvpn

# Selenium dependencies
# Firefox
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
RUN apt-get update
RUN apt-get -y install openjdk-11-jre xvfb python3-selenium firefox python3-pip

# 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 . ./

# Download and verify go dependencies
RUN go mod download && go mod verify

# 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"]