chore(build): Optimize Docker build configuration and process
This commit is contained in:
@@ -24,6 +24,7 @@ RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod cp -r /go/pkg/mod/github.com/yanyiwu/ /app/yanyiwu/
|
RUN --mount=type=cache,target=/go/pkg/mod cp -r /go/pkg/mod/github.com/yanyiwu/ /app/yanyiwu/
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# Get version and commit info for build injection
|
# Get version and commit info for build injection
|
||||||
ARG VERSION_ARG
|
ARG VERSION_ARG
|
||||||
@@ -38,7 +39,6 @@ ENV BUILD_TIME=${BUILD_TIME_ARG}
|
|||||||
ENV GO_VERSION=${GO_VERSION_ARG}
|
ENV GO_VERSION=${GO_VERSION_ARG}
|
||||||
|
|
||||||
# Build the application with version info
|
# Build the application with version info
|
||||||
COPY . .
|
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod make build-prod
|
RUN --mount=type=cache,target=/go/pkg/mod make build-prod
|
||||||
|
|
||||||
# Final stage
|
# Final stage
|
||||||
|
|||||||
Reference in New Issue
Block a user