-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
38 lines (31 loc) · 1.43 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
35
36
37
38
# Multi-stage build for minimal image size
FROM golang:1.25-alpine@sha256:8e02eb337d9e0ea459e041f1ee5eece41cbb61f1d83e7d883a3e2fb4862063fa AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=0.1.0-dev
ARG BUILD_DATE=unknown
ARG GIT_COMMIT=unknown
ARG LICENSE_PUBLIC_KEY=""
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags "-s -w \
-X github.com/luckyPipewrench/pipelock/internal/cliutil.Version=${VERSION} \
-X github.com/luckyPipewrench/pipelock/internal/cliutil.BuildDate=${BUILD_DATE} \
-X github.com/luckyPipewrench/pipelock/internal/cliutil.GitCommit=${GIT_COMMIT} \
-X github.com/luckyPipewrench/pipelock/internal/cliutil.GoVersion=$(go version | awk '{print $3}') \
-X github.com/luckyPipewrench/pipelock/internal/proxy.Version=${VERSION} \
-X github.com/luckyPipewrench/pipelock/internal/license.PublicKeyHex=${LICENSE_PUBLIC_KEY} \
-X github.com/luckyPipewrench/pipelock/internal/rules.KeyringHex=${LICENSE_PUBLIC_KEY}" \
-o /pipelock ./cmd/pipelock
# Scratch-based final image (~15MB)
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /pipelock /pipelock
EXPOSE 8888
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
CMD ["/pipelock", "healthcheck"]
ENTRYPOINT ["/pipelock"]
CMD ["run", "--listen", "0.0.0.0:8888"]