Open olegmosso opened 2 months ago
FROM golang:1.21-alpine3.19 AS base
WORKDIR /src COPY ./bridge-history-api/go.* ./ RUN go mod download -x
FROM base AS builder
WORKDIR /src/bridge-history-api/cmd/db_cli RUN --mount=type=cache,target=/root/.cache/go-build \ go build -v -p 4 -o /bin/db_cli
FROM alpine:latest COPY --from=builder /bin/db_cli /bin/db_cli WORKDIR /app ENTRYPOINT ["/bin/db_cli"]
Download Go dependencies
FROM golang:1.21-alpine3.19 AS base
WORKDIR /src COPY ./bridge-history-api/go.* ./ RUN go mod download -x
Build db_cli
FROM base AS builder
WORKDIR /src/bridge-history-api/cmd/db_cli RUN --mount=type=cache,target=/root/.cache/go-build \ go build -v -p 4 -o /bin/db_cli
Pull db_cli into a second stage deploy alpine container
FROM alpine:latest COPY --from=builder /bin/db_cli /bin/db_cli WORKDIR /app ENTRYPOINT ["/bin/db_cli"]