Files
telemt-api/Dockerfile
T
Denozordec 2a8390e687
Publish telemt-api gateway Docker image / test (push) Successful in 27s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m27s
Enhance Dockerfile and documentation for GeoIP directory permissions
- Updated Dockerfile to create and set ownership for the /var/lib/telemt-gateway directory, ensuring the gateway user has the necessary permissions.
- Added documentation in GEOIP.md to clarify directory permissions required for GeoIP data downloads, including guidance on volume mounting and user ID consistency.
2026-03-30 01:54:29 +07:00

25 lines
873 B
Docker

# syntax=docker/dockerfile:1
FROM golang:1.22-bookworm AS build
WORKDIR /src
COPY go.mod ./
COPY cmd/ ./cmd/
COPY internal/ ./internal/
RUN go mod tidy && go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/gateway ./cmd/gateway
# Alpine: non-root + wget for HEALTHCHECK (distroless has no shell/wget).
FROM alpine:3.19
RUN apk add --no-cache ca-certificates wget \
&& addgroup -S gateway -g 65532 \
&& adduser -S -u 65532 -G gateway gateway \
&& mkdir -p /var/lib/telemt-gateway \
&& chown gateway:gateway /var/lib/telemt-gateway
COPY --from=build /out/gateway /gateway
USER gateway:gateway
EXPOSE 8080
ENV CONFIG_PATH=/etc/telemt-gateway/config.yaml
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q -O- http://127.0.0.1:8080/health >/dev/null || exit 1
ENTRYPOINT ["/gateway"]