Skip to content

Commit fb0408e

Browse files
committed
Optimize Dockerfile layer caching for Go modules
1 parent 0c5184d commit fb0408e

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@ FROM golang:1.25 AS builder
22

33
WORKDIR /app
44

5-
COPY orborus.go /app/orborus.go
6-
COPY go.mod /app/go.mod
7-
8-
#RUN go get
5+
COPY go.mod go.sum ./
96
RUN go mod download
10-
RUN go mod tidy
11-
#RUN go build -v
127

13-
# Enabled CGO January 2025 (?)
14-
#RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o orborus.
15-
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app/orborus .
8+
COPY . .
9+
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/orborus .
1610

1711
FROM alpine:3.22.1
1812

0 commit comments

Comments
 (0)