mirror of
https://github.com/antoniomika/sish.git
synced 2025-09-26 19:21:15 +08:00
Add caching to docker build
This commit is contained in:
@@ -10,7 +10,9 @@ RUN apk add --no-cache git ca-certificates
|
||||
|
||||
COPY go.* ./
|
||||
|
||||
RUN go mod download
|
||||
RUN --mount=type=cache,target=/go/pkg/,rw \
|
||||
--mount=type=cache,target=/root/.cache/,rw \
|
||||
go mod download
|
||||
|
||||
FROM builder AS build-image
|
||||
|
||||
@@ -26,7 +28,9 @@ ARG TARGETARCH
|
||||
|
||||
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
|
||||
|
||||
RUN go build -o /go/bin/app -ldflags="-s -w -X github.com/${REPOSITORY}/cmd.Version=${VERSION} -X github.com/${REPOSITORY}/cmd.Commit=${COMMIT} -X github.com/${REPOSITORY}/cmd.Date=${DATE}"
|
||||
RUN --mount=type=cache,target=/go/pkg/,rw \
|
||||
--mount=type=cache,target=/root/.cache/,rw \
|
||||
go build -o /go/bin/app -ldflags="-s -w -X github.com/${REPOSITORY}/cmd.Version=${VERSION} -X github.com/${REPOSITORY}/cmd.Commit=${COMMIT} -X github.com/${REPOSITORY}/cmd.Date=${DATE}"
|
||||
|
||||
ENTRYPOINT ["/go/bin/app"]
|
||||
|
||||
|
Reference in New Issue
Block a user