us-dop-bot/Dockerfile
maximo tejeda 30f02a8d01
All checks were successful
${{ github.actor }} executed Build Push Prod / build (push) Successful in 3m50s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 20s
ADD tzadata
2024-12-04 23:01:30 -04:00

23 lines
635 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
RUN apk add --no-cache tzdata
ENTRYPOINT /usr/bin/us-dop-bot