-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
34 lines (25 loc) · 1.01 KB
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
FROM golang:1.26.1-alpine3.23
# 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
# Default is 'go telemetry local' which saves telemetry locally.
# Since data will never be uploaded, turn it off to avoid unnecessary file writes.
RUN go telemetry off
# 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"]