us-dop-api/Dockerfile
maximo tejeda a9ad7b77a4
All checks were successful
${{ github.actor }} executed Build Push Prod / build (push) Successful in 3m13s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 19s
ADD tzdata
2024-12-03 23:20:05 -04:00

21 lines
589 B
Docker

FROM golang:alpine AS builder
ARG TARGETARCH
ARG version=not-set
ARG SHORTSHA=not-set
WORKDIR /app
RUN apk update && apk add git
COPY . .
# https://stackoverflow.com/questions/70369368/check-architecture-in-dockerfile-to-get-amd-arm
RUN go build -o bin/us-dop-api \
-ldflags "-X main.Shortsha=${SHORTSHA} \
-X main.Version=${version} \
-X main.Aarch=${TARGETARCH}" ./cmd/api/main.go
FROM alpine AS runner
WORKDIR /app
COPY --from=builder /app/bin/us-dop-api /usr/bin/
COPY --from=builder /app/assets/ /app/assets/
RUN apk add --no-cache tzdata
ENTRYPOINT /usr/bin/us-dop-api