summaryrefslogtreecommitdiff
path: root/ci/docker/go-test.docker
blob: 3e56f6791c8ce11c83dbf6ebc4d1b19f8131053c (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
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-pyvirtualdisplay

# Install geckodriver and add to path
WORKDIR /eduvpn/go/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/go/vendor:$PATH"

# Set up file tree
WORKDIR /eduvpn/go

# Taken from golang docker example
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY ./go.mod go.sum ./
RUN go mod download && go mod verify

WORKDIR /eduvpn/go

# Copy go source
COPY ./src ./src

# Copy selenium scripts
COPY ./selenium_eduvpn.py ./selenium_eduvpn.py

# Run the tests
CMD ["go", "test", "-mod=readonly", "github.com/jwijenbergh/eduvpn-common/src", "-v"]