-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 695 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 695 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
# Build stage
FROM golang:1.26-alpine AS builder
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY *.go ./
# Build static binary
# Note: VERSION is passed as build arg during release builds
# Example: docker build --build-arg VERSION=v0.3.0
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -a -installsuffix cgo -o pentameter .
# Final stage
FROM scratch
# Copy the binary from builder stage
COPY --from=builder /app/pentameter /pentameter
# Copy CA certificates for HTTPS (if needed)
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
EXPOSE 8080
ENTRYPOINT ["/pentameter"]