Files
lincodex/runner/Dockerfile.sandbox-test
T

30 lines
1.2 KiB
Docker

# DEVELOPMENT AND CI ONLY: the isolation test image. It adds the compiled
# isolation tests and the hostile fixtures to a locally built runner image and
# is started by make -C runner test-sandbox with the privileges that nsjail
# needs inside Docker. It is never a release or production image.
ARG GO_IMAGE=golang:1.26.9-alpine
ARG RUNNER_IMAGE=lincodex-runner-dev:local
FROM ${GO_IMAGE} AS build
ENV GOTOOLCHAIN=local
WORKDIR /src/runner
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go test -c -tags sandbox -o /out/isolation.test ./internal/isolationtest \
&& CGO_ENABLED=0 GOOS=linux go test -c -tags sandbox -o /out/judge.test ./internal/judgetest
FROM ${RUNNER_IMAGE}
COPY --from=build /out/isolation.test /out/judge.test /opt/lincodex-runner-tests/
COPY testdata/hostile /opt/lincodex-runner-tests/testdata/hostile
COPY testdata/judge /opt/lincodex-runner-tests/testdata/judge
ENV RUNNER_HOSTILE_FIXTURES=/opt/lincodex-runner-tests/testdata/hostile \
RUNNER_JUDGE_FIXTURES=/opt/lincodex-runner-tests/testdata/judge
HEALTHCHECK NONE
ENTRYPOINT ["/bin/sh", "-c", "set -e; for suite in judge isolation; do /opt/lincodex-runner-tests/$suite.test -test.v -test.count=1; done"]