-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.test
More file actions
34 lines (22 loc) · 838 Bytes
/
Dockerfile.test
File metadata and controls
34 lines (22 loc) · 838 Bytes
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
# Copyright 2025 Matheus Pimenta.
# SPDX-License-Identifier: AGPL-3.0
ARG TARGETARCH
# Build stage
FROM golang:1.26.1-alpine3.23@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 AS builder
RUN apk add --no-cache clang llvm bpftool libbpf-dev
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
COPY ./api/ ./api/
COPY ./internal/ ./internal/
COPY ./ebpf/ ./ebpf/
RUN go generate ./internal/redirect
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go test -c github.com/matheuscscp/gke-metadata-server/internal/server
# Runtime stage
FROM alpine:3.23@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659
WORKDIR /app
# Copy only the compiled test binary
COPY --from=builder /app/server.test ./
CMD [ "sh", "-c", "sleep 2 && ./server.test -test.v" ]