aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..77d54d6
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,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