aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: b3f1639f09a60e48388017d6b9eb56965abd73fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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"]