Files
telemt/Dockerfile
T

71 lines
1.5 KiB
Docker
Raw Normal View History

2026-03-22 00:10:19 +03:00
# syntax=docker/dockerfile:1
ARG BINARY
2026-02-13 21:06:06 +03:00
# ==========================
# Stage: minimal
2026-02-13 21:06:06 +03:00
# ==========================
2026-03-22 00:10:19 +03:00
FROM debian:12-slim AS minimal
RUN apt-get update && apt-get install -y --no-install-recommends \
binutils \
2026-03-22 11:16:09 +03:00
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
\
&& curl -fL \
--retry 5 \
--retry-delay 3 \
--connect-timeout 10 \
--max-time 120 \
-o /tmp/upx.tar.xz \
https://github.com/telemt/telemt/releases/download/toolchains/upx-amd64_linux.tar.xz \
&& tar -xf /tmp/upx.tar.xz -C /tmp \
&& mv /tmp/upx*/upx /usr/local/bin/upx \
&& chmod +x /usr/local/bin/upx \
&& rm -rf /tmp/upx*
2026-03-22 00:10:19 +03:00
COPY ${BINARY} /telemt
2026-03-22 00:10:19 +03:00
RUN strip /telemt || true
RUN upx --best --lzma /telemt || true
# ==========================
# Debug image
2026-03-22 00:10:19 +03:00
# ==========================
FROM debian:12-slim AS debug
2026-02-13 21:06:06 +03:00
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
2026-03-22 00:10:19 +03:00
tzdata \
curl \
iproute2 \
busybox \
2026-02-13 21:06:06 +03:00
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
2026-03-22 00:10:19 +03:00
COPY --from=minimal /telemt /app/telemt
2026-02-13 21:06:06 +03:00
COPY config.toml /app/config.toml
EXPOSE 443 9090 9091
2026-03-22 00:10:19 +03:00
ENTRYPOINT ["/app/telemt"]
CMD ["config.toml"]
# ==========================
# Production (REAL distroless)
2026-03-22 00:10:19 +03:00
# ==========================
FROM gcr.io/distroless/static-debian12 AS prod
2026-03-22 00:10:19 +03:00
WORKDIR /app
COPY --from=minimal /telemt /app/telemt
COPY config.toml /app/config.toml
USER nonroot:nonroot
2026-02-13 21:06:06 +03:00
EXPOSE 443 9090 9091
2026-02-13 21:06:06 +03:00
ENTRYPOINT ["/app/telemt"]
CMD ["config.toml"]