forked from project-copacetic/copacetic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.Dockerfile
More file actions
36 lines (25 loc) · 996 Bytes
/
frontend.Dockerfile
File metadata and controls
36 lines (25 loc) · 996 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
# syntax=docker/dockerfile:1
FROM golang:1.25-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git ca-certificates
# Set working directory
WORKDIR /src
# Copy go mod files
COPY go.mod go.sum ./
# Copy source code
COPY . .
# Build the frontend binary with cache mounts for faster builds
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gocache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /copa-frontend ./cmd/frontend
# Final image
FROM scratch AS frontend
# Copy CA certificates for HTTPS connections
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy the frontend binary
COPY --from=builder /copa-frontend /copa-frontend
# Add BuildKit frontend capability labels
LABEL moby.buildkit.frontend.network.none="true"
LABEL moby.buildkit.frontend.caps="moby.buildkit.frontend.inputs,moby.buildkit.frontend.contexts"
# Set the entrypoint
ENTRYPOINT ["/copa-frontend"]