- commit
- fd8e7ba
- parent
- c247922
- author
- Antonio Mika
- date
- 2024-09-18 14:33:39 +0000 UTC
Add more caching to builds
1 files changed,
+9,
-3
+9,
-3
1@@ -8,7 +8,9 @@ RUN apt-get install -y git ca-certificates
2
3 COPY go.* ./
4
5-RUN go mod download
6+RUN --mount=type=cache,target=/go/pkg/,rw \
7+ --mount=type=cache,target=/root/.cache/,rw \
8+ go mod download
9
10 FROM builder-deps AS builder-web
11
12@@ -23,7 +25,9 @@ ENV LDFLAGS="-s -w"
13
14 ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
15
16-RUN go build -ldflags "$LDFLAGS" -o /go/bin/${APP}-web ./cmd/${APP}/web
17+RUN --mount=type=cache,target=/go/pkg/,rw \
18+ --mount=type=cache,target=/root/.cache/,rw \
19+ go build -ldflags "$LDFLAGS" -o /go/bin/${APP}-web ./cmd/${APP}/web
20
21 FROM builder-deps AS builder-ssh
22
23@@ -38,7 +42,9 @@ ENV LDFLAGS="-s -w"
24
25 ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
26
27-RUN go build -ldflags "$LDFLAGS" -o /go/bin/${APP}-ssh ./cmd/${APP}/ssh
28+RUN --mount=type=cache,target=/go/pkg/,rw \
29+ --mount=type=cache,target=/root/.cache/,rw \
30+ go build -ldflags "$LDFLAGS" -o /go/bin/${APP}-ssh ./cmd/${APP}/ssh
31
32 FROM scratch AS release-web
33