Files
OpenShell/deploy/docker/Dockerfile.cluster

54 lines
2.4 KiB
Docker

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# k3s cluster image with NemoClaw Helm charts and manifests
#
# This image is based on k3s and includes:
# - Packaged NemoClaw Helm chart
# - HelmChart CR for auto-deploying NemoClaw
# - Custom entrypoint for DNS configuration in Docker environments
#
# Component images (navigator/server, navigator/sandbox) are
# pulled at runtime from the distribution registry rather than bundled as tarballs.
# Registry credentials are generated by the entrypoint script at container start.
#
# The helm charts are built by the docker:build:cluster mise task
# and placed in deploy/docker/.build/ before this Dockerfile is built.
ARG K3S_VERSION=v1.29.8-k3s1
FROM rancher/k3s:${K3S_VERSION}
# Create directories for manifests, charts, and configuration
RUN mkdir -p /var/lib/rancher/k3s/server/manifests \
/var/lib/rancher/k3s/server/static/charts \
/etc/rancher/k3s \
/opt/navigator/manifests \
/opt/navigator/charts
# Copy entrypoint script that configures DNS for Docker environments
# This script detects the host gateway IP and configures CoreDNS to use it
COPY deploy/docker/cluster-entrypoint.sh /usr/local/bin/cluster-entrypoint.sh
RUN chmod +x /usr/local/bin/cluster-entrypoint.sh
# Copy healthcheck script that verifies cluster readiness
COPY deploy/docker/cluster-healthcheck.sh /usr/local/bin/cluster-healthcheck.sh
RUN chmod +x /usr/local/bin/cluster-healthcheck.sh
# Registry credentials for pulling component images at runtime are generated
# by the entrypoint script at /etc/rancher/k3s/registries.yaml.
# Copy packaged helm charts to a staging directory that won't be
# overwritten by the /var/lib/rancher/k3s volume mount. The entrypoint
# script copies them into the k3s static charts directory at container start.
COPY deploy/docker/.build/charts/*.tgz /opt/navigator/charts/
# Copy Kubernetes manifests to a persistent location that won't be overwritten by the volume mount.
# The bootstrap code will copy these to /var/lib/rancher/k3s/server/manifests/ after cluster start.
COPY deploy/kube/manifests/*.yaml /opt/navigator/manifests/
# Use custom entrypoint that configures DNS before starting k3s
ENTRYPOINT ["/usr/local/bin/cluster-entrypoint.sh"]
HEALTHCHECK --interval=5s --timeout=5s --start-period=20s --retries=60 \
CMD ["/usr/local/bin/cluster-healthcheck.sh"]