aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 102353b4c78d1372a9777f6c2d277eb8c579640e (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
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM

RUN apk add --no-cache tzdata git

WORKDIR /app

COPY . .

RUN CGO_ENABLED=0 GOOS=$(echo $TARGETPLATFORM | cut -d'/' -f1) \
    GOARCH=$(echo $TARGETPLATFORM | cut -d'/' -f2) \
    GOARM=$(echo $TARGETPLATFORM | cut -d'/' -f3 | sed 's/v//' || echo "7") \
    go build \
    -trimpath \
    -ldflags="-s -w -X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo 'dev')" \
    -o /app ./cmd/...

FROM scratch

LABEL maintainer="neonxp" \
      description="qChat - quick ssh chat" \
      version="1.0"

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /app /app

ENV TZ=Europe/Moscow

EXPOSE 1337