build: add Dockerfile for api
This commit is contained in:
parent
c94098afef
commit
0c93db2644
1 changed files with 26 additions and 0 deletions
26
build/package/api/Dockerfile
Normal file
26
build/package/api/Dockerfile
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
FROM --platform=${BUILDPLATFORM} golang:1.23-alpine3.20 AS builder
|
||||
|
||||
ARG BUILDPLATFORM
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /build/backoffice-api ./cmd/api
|
||||
|
||||
FROM alpine:3.20 AS runtime
|
||||
|
||||
WORKDIR /srv
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
COPY --from=builder /build/backoffice-api /app/backoffice-api
|
||||
|
||||
CMD ["/srv/backoffice-api"]
|
||||
Reference in a new issue