-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
30 lines (22 loc) · 869 Bytes
/
Dockerfile
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
FROM golang:1.22.5-alpine3.20
# Add addtional packages needed for the race detector to work
RUN apk add --update build-base make
# Add a non-root user to run our code as
RUN adduser --disabled-password appuser
# Copy the source code into the container
# and make sure appuser owns all of it
COPY --chown=appuser:appuser . /opt/test-runner
# Build and run the testrunner with appuser
USER appuser
# This populates the build cache with the standard library
# and command packages so future compilations are faster
RUN go build std cmd
# Install external packages
WORKDIR /opt/test-runner/external-packages
RUN go mod download
# Populate the build cache with the external packages
RUN go build ./...
# Build the test runner
WORKDIR /opt/test-runner
RUN go build -o /opt/test-runner/bin/test-runner /opt/test-runner
ENTRYPOINT ["sh", "/opt/test-runner/bin/run.sh"]