mirror of
https://github.com/Chipazawra/v8-1c-cluster-pde.git
synced 2024-12-25 01:32:38 +02:00
19 lines
410 B
Docker
19 lines
410 B
Docker
# Step 1: Modules caching
|
|
FROM golang:1.17.1-alpine3.14 as modules
|
|
COPY go.mod go.sum /modules/
|
|
WORKDIR /modules
|
|
RUN go mod download
|
|
|
|
# Step 2: Builder
|
|
FROM golang:1.17.1-alpine3.14 as builder
|
|
COPY --from=modules /go/pkg /go/pkg
|
|
COPY . /app
|
|
WORKDIR /app
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -o /bin/app ./cmd/app
|
|
|
|
# Step 3: Final
|
|
FROM scratch
|
|
COPY --from=builder /bin/app /app
|
|
|
|
CMD ["/app"] |