diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:47:35 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:47:35 +0300 |
commit | 96e2ce2e9d363a6296f9411ecb00168520258874 (patch) | |
tree | 09aa7fffe10eab84ae0edd39e570355984ba0148 /Dockerfile | |
parent | 12ed72e4e1da181a6c87319a50d3b4142788b4c0 (diff) |
Отказ от echo
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -1,18 +1,39 @@ # syntax=docker/dockerfile:1 -FROM golang:1.22.5-alpine3.20 AS builder +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 CGO_ENABLED=0 GOOS=linux go build -o /app/gorum +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 -FROM alpine:3.20 +COPY --from=builder /app/gorum /app/gorum -COPY --from=builder /app/gorum . +EXPOSE 8000 -ENTRYPOINT ["/gorum"]
\ No newline at end of file +ENTRYPOINT ["/app/gorum"]
\ No newline at end of file |