forked from evrone/go-clean-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c25f2cd
commit c339a9c
Showing
3 changed files
with
29 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# Step 1: Modules caching | ||
FROM golang:alpine as modules | ||
COPY go.mod go.sum /modules/ | ||
WORKDIR /modules | ||
RUN go mod download | ||
|
||
# Step 2: Builder | ||
FROM golang:alpine as builder | ||
COPY --from=modules /go/pkg /go/pkg | ||
COPY . /app | ||
WORKDIR /app | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ | ||
go build -tags migrate -o /bin/app ./cmd/app | ||
|
||
# Step 3: Final | ||
FROM scratch | ||
COPY --from=builder /app/config /config | ||
COPY --from=builder /app/migrations /migrations | ||
COPY --from=builder /bin/app /app | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Step 1: Modules caching | ||
FROM golang:alpine as modules | ||
COPY go.mod go.sum /modules/ | ||
WORKDIR /modules | ||
RUN go mod download | ||
|
||
# Step 2: Builder | ||
FROM golang:alpine as builder | ||
COPY --from=modules /go/pkg /go/pkg | ||
COPY . /app | ||
WORKDIR /app | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ | ||
go build -tags migrate -o /bin/app ./cmd/app | ||
|
||
# Step 3: Final | ||
FROM alpine | ||
COPY --from=builder /app/config /config | ||
COPY --from=builder /app/migrations /migrations | ||
COPY --from=builder /bin/app /app | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
CMD ["/app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters