FROM golang:1.22-alpine AS builder

WORKDIR /src
RUN apk add --no-cache ca-certificates git tzdata

COPY go.mod go.sum ./
RUN go mod download

COPY . .
ARG TARGETARCH=amd64
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /out/goff ./cmd/goff

FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata

COPY --from=builder /out/goff /usr/local/bin/goff

ENTRYPOINT ["/usr/local/bin/goff"]
