-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 790 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 790 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
# Build stage
FROM golang:1.25.7-alpine3.21 AS builder
ARG VERSION=dev
WORKDIR /app
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# Build with optimizations
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-w -s -X github.com/ignacio/lumo/internal/version.Version=${VERSION}" \
-trimpath \
-o lumo ./cmd/lumo
# Compress binary with UPX (reduces size ~50-70%)
# Note: Using -9 instead of --best --lzma to avoid OOM in constrained environments
RUN apk add --no-cache upx && upx -9 lumo
# Final stage - scratch for minimal size (~5-10MB total)
FROM scratch
# Copy CA certificates for HTTPS
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy binary
COPY --from=builder /app/lumo /lumo
EXPOSE 8080
ENTRYPOINT ["/lumo"]