us-dop-bot/Dockerfile
maximo tejeda 35d30336d8
All checks were successful
${{ github.actor }} executed Build Push Prod / build (push) Successful in 3m44s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 19s
ADD git
2024-12-04 22:32:09 -04:00

21 lines
604 B
Docker

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