-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 852 Bytes
/
Copy pathDockerfile
File metadata and controls
35 lines (24 loc) · 852 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
# Build stage
FROM golang:1.25-alpine@sha256:523c3effe300580ed375e43f43b1c9b091b68e935a7c3a92bfcc4e7ed55b18c2 AS builder
WORKDIR /build
# Install git for version info
RUN apk add --no-cache git
# Copy go mod files first for caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build with version info
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_DATE=unknown
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${BUILD_DATE}" \
-o cascade \
./cmd/cascade
# Runtime stage - minimal image with git
FROM alpine:3.19@sha256:6baf43584bcb78f2e5847d1de515f23499913ac9f12bdf834811a3145eb11ca1
RUN apk add --no-cache git ca-certificates
COPY --from=builder /build/cascade /usr/local/bin/cascade
WORKDIR /work
ENTRYPOINT ["/usr/local/bin/cascade"]