Files
panel/deploy/Dockerfile.controller
T
2026-07-15 01:06:16 -07:00

30 lines
1.2 KiB
Docker

# Panel controller — production image.
# Build from the repo root: docker build -f deploy/Dockerfile.controller .
# (the Makefile "docker" target does exactly this, injecting VERSION)
FROM golang:1.26 AS build
ARG VERSION=dev
WORKDIR /src
# The repo is a Go workspace (go.work) spanning controller/agent/pkg/proto —
# copy the whole tree so workspace resolution works.
COPY . .
ENV CGO_ENABLED=0
RUN go build -trimpath \
-ldflags "-s -w -X github.com/dbledeez/panel/pkg/version.Version=${VERSION}" \
-o /out/controller ./controller/cmd/controller \
&& go build -trimpath \
-ldflags "-s -w -X github.com/dbledeez/panel/pkg/version.Version=${VERSION}" \
-o /out/panelctl ./controller/cmd/panelctl
FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /opt/panel
COPY --from=build /out/controller /opt/panel/bin/controller
COPY --from=build /out/panelctl /opt/panel/bin/panelctl
# Module manifests: the controller's port allocator reads ./modules.
COPY --from=build /src/modules /opt/panel/modules
# CA, admin-token, cluster stores — persist this volume.
VOLUME ["/opt/panel/data"]
EXPOSE 8080 8443
ENTRYPOINT ["/opt/panel/bin/controller"]
CMD ["-http", ":8080", "-grpc", ":8443", "-ca-dir", "./data/ca"]