Push to Registry
How to build and publish templates to a registry
How to Push to Registry
Build and publish your template to make it available for others to use.
Prerequisites
- Docker with buildx support
- Access to a Docker registry (Docker Hub, GHCR, or private)
- CyanPrint CLI for registration
Build Template Image
Build the template image for multiple architectures:
docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/template.Dockerfile \-t myorg/my-template:1.0.0 \--push .
The --push flag pushes immediately after build.
Build Blob Image
Build the blob image containing your template files:
docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/blob.Dockerfile \-t myorg/my-template-blob:1.0.0 \--push .
Register with CyanPrint
Register your template with the CyanPrint registry:
cyanprint push template --token $CYAN_TOKEN \myorg/my-template-blob 1.0.0 \myorg/my-template 1.0.0
Build Options
Multi-Architecture Builds
Build for multiple platforms:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \-f cyan/template.Dockerfile \-t myorg/my-template:1.0.0 \--push .
Build Without Push
Build locally for testing:
docker buildx build --platform linux/amd64 \-f cyan/template.Dockerfile \-t myorg/my-template:dev \--load .
The --load flag loads the image into Docker for local use.
Version Tagging
Use semantic versioning:
# Tag with versiondocker buildx build -t myorg/my-template:1.0.0 --push .# Also tag latestdocker buildx build -t myorg/my-template:latest --push .
Registry Options
Docker Hub
docker logindocker buildx build -t docker.io/myorg/my-template:1.0.0 --push .
GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdindocker buildx build -t ghcr.io/myorg/my-template:1.0.0 --push .
Private Registry
docker login registry.example.comdocker buildx build -t registry.example.com/myorg/my-template:1.0.0 --push .
Verification
Verify your template is published:
# List templatescyanprint list myorg/# Get template infocyanprint info myorg/my-template:1.0.0
CI/CD Integration
GitHub Actions
.github/workflows/publish.yml
name: Publish Templateon:release:types: [published]jobs:publish:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4- name: Set up Docker Buildxuses: docker/setup-buildx-action@v3- name: Login to GitHub Container Registryuses: docker/login-action@v3with:registry: ghcr.iousername: ${{ github.actor }}password: ${{ secrets.GITHUB_TOKEN }}- name: Build and Push Templaterun: |docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/template.Dockerfile \-t ghcr.io/${{ github.repository_owner }}/my-template:${{ github.event.release.tag_name }} \--push .- name: Build and Push Blobrun: |docker buildx build --platform linux/amd64,linux/arm64 \-f cyan/blob.Dockerfile \-t ghcr.io/${{ github.repository_owner }}/my-template-blob:${{ github.event.release.tag_name }} \--push .- name: Register with CyanPrintrun: |cyanprint push template --token ${{ secrets.CYAN_TOKEN }} \ghcr.io/${{ github.repository_owner }}/my-template-blob ${{ github.event.release.tag_name }} \ghcr.io/${{ github.repository_owner }}/my-template ${{ github.event.release.tag_name }}
See Docker vs Cyan Registry for the differences between Docker registries and CyanPrint's internal registry.
Related
- Docker vs Cyan Registry - Registry comparison
- Project Structure - Template project structure
- Dockerfiles Reference - Dockerfile configuration