-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (25 loc) · 967 Bytes
/
Dockerfile
File metadata and controls
41 lines (25 loc) · 967 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
35
36
37
38
39
40
41
FROM golang:1.25.7-alpine3.22 AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags="-s -w" -trimpath -o /out/server ./cmd/server
FROM golang:1.25.7-alpine3.22 AS ci
RUN apk add --no-cache curl bash docker-cli
RUN curl -sSfL https://golangci-lint.run/install.sh \
| sh -s -- -b /usr/local/bin v2.10.1
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh \
| sh -s -- -b /usr/local/bin v0.69.0
RUN curl -Lo /usr/local/bin/kind \
https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 \
&& chmod +x /usr/local/bin/kind
RUN curl -Lo /usr/local/bin/kubectl \
https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl
WORKDIR /src
FROM gcr.io/distroless/static-debian12:nonroot AS final
COPY --from=builder /out/server /server
USER 1000
EXPOSE 8080
ENTRYPOINT ["/server"]