Files
monlet/deploy/docker/agent.Dockerfile
2026-05-27 10:01:59 +04:00

22 lines
901 B
Docker

# Dockerized monlet-agent for the showcase / e2e stand only.
# Production deployment uses a systemd-managed Go binary; do not use this image in prod.
# Build context: repo root (we need ../agent).
FROM golang:1.25-alpine AS builder
WORKDIR /src
ENV CGO_ENABLED=0 GOTOOLCHAIN=auto
ARG MONLET_AGENT_VERSION=0.1.0
COPY agent/go.mod agent/go.sum ./
RUN go mod download
COPY agent/ ./
RUN go build -trimpath -ldflags="-s -w -X main.version=${MONLET_AGENT_VERSION}" -o /out/monlet-agent ./cmd/monlet-agent
FROM ubuntu:24.04
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /out/monlet-agent /usr/local/bin/monlet-agent
RUN mkdir -p /var/lib/monlet-agent /etc/monlet /opt/monlet/checks
ENV MONLET_CONFIG=/etc/monlet/agent.toml
ENTRYPOINT ["/bin/sh","-c","exec /usr/local/bin/monlet-agent -config \"$MONLET_CONFIG\""]