Files
OpenShell/deploy/docker/Dockerfile.cluster
Drew Newberry 07b5ddac33 feat(cluster): speed up local deploy loop with incremental change tracking (!53)
## Summary
- Track last deployed local changes and only redeploy new deltas in auto mode.
- Add per-component fingerprints (server/sandbox/helm) persisted to .cache/cluster-deploy-fast.state.
- Update docs for the new incremental deploy behavior.

```
mise run cluster

....

________________________________________________________
Executed in   75.21 secs      fish           external
   usr time  578.03 millis    0.25 millis  577.78 millis
   sys time  364.45 millis    1.22 millis  363.22 millis
```

with a change to `navigator-sandbox` (triggers rust recompile)

```
⟩ time mise run cluster:deploy
[cluster:deploy] $ build/scripts/cluster-deploy-fast.sh
Change detection took 0s
Fast deploy plan:
  build server:  0
  build sandbox: 1
  helm upgrade:  1

...

________________________________________________________
Executed in   25.88 secs      fish           external
   usr time  618.91 millis    0.24 millis  618.67 millis
   sys time  557.71 millis    1.54 millis  556.18 millis



```

(most time is spent in docker build)

## Test Plan
- mise run pre-commit
2026-02-25 08:34:43 -08:00

48 lines
2.1 KiB
Docker

# k3s cluster image with Navigator Helm charts and manifests
#
# This image is based on k3s and includes:
# - Packaged Navigator Helm chart
# - HelmChart CR for auto-deploying Navigator
# - 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 and configuration
RUN mkdir -p /var/lib/rancher/k3s/server/manifests \
/var/lib/rancher/k3s/server/static/charts \
/etc/rancher/k3s \
/opt/navigator/manifests
# 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 chart to static directory for serving via k3s API
COPY deploy/docker/.build/charts/*.tgz /var/lib/rancher/k3s/server/static/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"]