How rajeshseenu/llm-acr-bootstrap works
Purpose and Entry Point
This repository is a run-once shell pipeline for packaging a Hugging Face model into a Docker image suitable for vLLM, then pushing it to Azure Container Registry (ACR). The executable entry point is bootstrap.sh; image construction is defined by Dockerfile.
Bootstrap Orchestration
bootstrap.sh drives the lifecycle: creates a temporary checkout, ensures Docker is available, collects model/registry/auth inputs interactively, builds, pushes, and removes local artifacts. It is intended to be invoked either directly from a checkout or streamed through curl | bash.
Paths: bootstrap.sh, README.md.
Authentication and Secret Boundary
The script supports two ACR authentication boundaries:
• Azure CLI device-code authentication (az login --use-device-code), avoiding password entry.
• Docker registry login with credentials supplied through stdin.
The Hugging Face access token remains in a shell variable and is injected into the build only as a BuildKit secret. It must not be persisted in the temporary checkout, Docker layers, command-line arguments, or shell history.
Paths: bootstrap.sh, Dockerfile.
Container Build Pipeline
Dockerfile is a multi-stage build. Its fetch stage downloads model artifacts from Hugging Face, with the token available only through a secret mount at /run/secrets/hf_token. A later runtime stage packages the fetched weights into the serving image, targeting vLLM consumption. This stage separation prevents credentials from reaching the final image.
Paths: Dockerfile.
Artifact Publishing Flow
The primary flow is:
1. User provides Hugging Face model identifier and optional token.
2. User provides ACR login server and target image name/tag.
3. bootstrap.sh invokes a BuildKit-enabled Docker build using Dockerfile.
4. Docker pushes the resulting image to the specified ACR repository.
5. The local image and build cache are removed after completion.
External endpoints include Hugging Face (huggingface.co), Docker Hub for base images, and the target Azure Container Registry.
Paths: bootstrap.sh, Dockerfile.
Cleanup and Failure Handling
Cleanup is an architectural guarantee rather than a best-effort post-step. bootstrap.sh registers trap cleanup EXIT INT TERM, so normal exit, failure, interruption, and termination trigger registry logout, removal of local image/build cache, temporary-checkout deletion, and credential-variable unsetting. Docker itself may remain installed because it is treated as a system dependency.
Paths: bootstrap.sh.
Runtime and Deployment Model
The produced artifact is a Docker image containing model weights for vLLM-oriented serving; this repository does not implement the serving application or deploy it. Azure Container Registry is the publication target, while downstream infrastructure is expected to pull and run the image. The build can be adapted for LoRA-only images by changing the fetch/final-copy relationship so base model weights reside in a separate image.
Paths: Dockerfile, README.md.
Main entry points: bootstrap.sh Bootstrap Pipeline · Dockerfile Model Fetch Stage · README.md Usage Guide
Components 15
Bootstrap Orchestration
- Usage Guide
README.md - Bootstrap Pipeline · Run-once build, publish, and cleanup orchestrator.
bootstrap.sh - Temporary Checkout · Ephemeral working directory removed by cleanup.
- Docker with BuildKit
- Azure CLI Device Login · Optional device-code ACR authentication path.
- Docker Registry Login · Credentials are provided through stdin.
- Trap Cleanup · Runs on exit, failure, interruption, or termination.
bootstrap.sh
Container Build
- Multi-stage Recipe
Dockerfile - Model Fetch Stage · Downloads model artifacts with a BuildKit secret mount.
Dockerfile - vLLM Runtime Image · Packages fetched weights without the Hugging Face token.
Dockerfile
External Services
- Hugging Face
- Docker Hub
- Azure Container Registry · Publication target for the built image.
- Downstream Serving · External infrastructure pulls and runs the vLLM-oriented image.
Other components
- Operator
Connections 21
- Operator → Usage Guide: reads
- Operator → Bootstrap Pipeline: runs; supplies model and target
- Bootstrap Pipeline → Temporary Checkout: creates
- Bootstrap Pipeline → Docker with BuildKit: ensures and invokes
- Bootstrap Pipeline → Azure CLI Device Login: optional auth
- Bootstrap Pipeline → Docker Registry Login: registry auth
- Azure CLI Device Login → Azure Container Registry: authenticates to
- Docker Registry Login → Azure Container Registry: authenticates to
- Docker with BuildKit → Multi-stage Recipe: builds from
- Multi-stage Recipe → Model Fetch Stage: defines
- Multi-stage Recipe → vLLM Runtime Image: defines
- Model Fetch Stage → Hugging Face: downloads model; secret token mount
- Model Fetch Stage → vLLM Runtime Image: copies fetched weights
- Docker Hub → Model Fetch Stage: provides base image
- Docker Hub → vLLM Runtime Image: provides base image
- vLLM Runtime Image → Azure Container Registry: pushes tagged image
- Azure Container Registry → Downstream Serving: image is pulled by
- Bootstrap Pipeline → Trap Cleanup: registers EXIT/INT/TERM trap
- Trap Cleanup → Temporary Checkout: deletes
- Trap Cleanup → Docker with BuildKit: removes local image and cache
- Trap Cleanup → Azure Container Registry: logs out