# syntax=docker/dockerfile:1 FROM --platform=$BUILDPLATFORM golang:1.22.5-alpine3.20 AS builder ARG TARGETARCH ARG TARGETOS ENV CGO_ENABLED 0 ENV GOOS linux RUN apk update --no-cache && apk add --no-cache tzdata ca-certificates WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /app/gorum FROM --platform=$BUILDPLATFORM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /usr/share/zoneinfo/Europe/Moscow /usr/share/zoneinfo/Europe/Moscow ENV TZ Europe/Moscow WORKDIR /app COPY --from=builder /app/gorum /app/gorum EXPOSE 8000 ENTRYPOINT ["/app/gorum"]