File tree 2 files changed +10
-6
lines changed
content/manuals/build/ci/github-actions
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -139,13 +139,16 @@ Example Dockerfile in `build/package/Dockerfile`
139
139
FROM golang:1.21.1-alpine as base-build
140
140
141
141
WORKDIR /build
142
- RUN go env -w GOMODCACHE=/root/.cache/go-build
143
142
144
- COPY go.mod go.sum ./
145
- RUN --mount=type=cache,target=/root/.cache/go-build go mod download
143
+ RUN --mount=type=cache,target=/go/pkg/mod \
144
+ --mount=type=bind,source=go.mod,target=go.mod \
145
+ --mount=type=bind,source=go.sum,target=go.sum \
146
+ go mod download
146
147
147
- COPY ./src ./
148
- RUN --mount=type=cache,target=/root/.cache/go-build go build -o /bin/app /build/src
148
+ RUN --mount=type=cache,target=/go/pkg/mod \
149
+ --mount=type=cache,target=/root/.cache/go-build \
150
+ --mount=type=bind,target=. \
151
+ go build -o /bin/app /build/src
149
152
...
150
153
` ` `
151
154
Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ FROM golang:${GO_VERSION}-alpine AS base
8
8
RUN apk add --no-cache openssl
9
9
ENV CGO_ENABLED=0
10
10
WORKDIR /src
11
- COPY go.mod go.sum ./
12
11
RUN --mount=type=cache,target=/go/pkg/mod \
12
+ --mount=type=bind,source=go.mod,target=go.mod \
13
+ --mount=type=bind,source=go.sum,target=go.sum \
13
14
go mod download
14
15
15
16
FROM base AS releaser
You can’t perform that action at this time.
0 commit comments