Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile-test 753 B
# syntax=docker/dockerfile:1.2
FROM golang:1.22 AS builder
LABEL authors="Torgrim Thorsen"
# Set destination for COPY
WORKDIR /app
# Download Go modules
COPY go.mod go.sum ./
# Copy the source code.
COPY ../ ./
# Build
RUN CGO_ENABLED=0 GOOS=linux go test -cover -coverpkg=./... -c -installsuffix cgo -o test ./cmd/globeboard
# Use a minimal alpine image for the final build stage.
FROM golang:1.22-alpine
# Install CA certificates and Go.
RUN apk --no-cache add ca-certificates
# Install Report Tool.
RUN go install github.com/jstemmer/go-junit-report/v2@latest
WORKDIR /root/
# Copy the pre-built binary file from the previous stage.
COPY --from=builder /app/test .
# Run
CMD ./test -test.v | go-junit-report > report.xml && ./test -test.v