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

ARG TARGETPLATFORM
ARG BUILDPLATFORM

RUN apk add --no-cache 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 /app /app

ENV TZ=Europe/Moscow

EXPOSE 1337