Container image publishing
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
This guide is the provider-neutral container image publishing baseline for freshly generated Cephalon apps.
Use it when you want a generated host to move from scaffolded source into a reusable build/tag/push image contract through the shipped Dockerfile and deploy/container-image/publish-image.ps1, before you hand that image to Kubernetes or another hosted container platform.
What ships now
Section titled “What ships now”Generated app roots from cephalon new and the app-focused dotnet new cephalon-* starters now include:
NuGet.config.cephalon/packages/README.mdDockerfiledeploy/container-image/README.mddeploy/container-image/publish-image.ps1
The generated publish script validates the generated app root, builds the shipped Dockerfile with one or more tags, and can optionally push those tags to the registry you choose without introducing provider-specific packaging first.
Prerequisites
Section titled “Prerequisites”- a generated app root from
cephalon newordotnet new cephalon-* Cephalon*packages available either through./.cephalon/packagesor a shared package source that replaces the generatedcephalonfeed entry- Docker Desktop or another compatible Docker engine on the machine that performs the build
docker loginalready completed for the target registry before you invoke the generated script with-Push
Preview the build and push contract
Section titled “Preview the build and push contract”Example for a scaffolded modular-monolith app:
pwsh ./Acme.Store/deploy/container-image/publish-image.ps1 ` -Image ghcr.io/acme/acme-store:1.0.0 ` -AdditionalTags ghcr.io/acme/acme-store:latest ` -Push ` -PreviewThe preview step:
- validates that the generated app root still contains
DockerfileandNuGet.config - prints the
docker buildcommand it would run - prints one
docker pushcommand per image tag when-Pushis supplied - does not contact the registry or start a real image build
If you need to target a specific runtime platform, also pass -Platform linux/amd64 or another Docker-compatible platform string.
Build the generated image locally
Section titled “Build the generated image locally”If you only want the local image first:
pwsh ./Acme.Store/deploy/container-image/publish-image.ps1 ` -Image ghcr.io/acme/acme-store:1.0.0That keeps the tag local so you can validate the Docker image before you publish it.
Publish the image to a registry
Section titled “Publish the image to a registry”When you are ready to push the image:
docker login ghcr.iopwsh ./Acme.Store/deploy/container-image/publish-image.ps1 ` -Image ghcr.io/acme/acme-store:1.0.0 ` -AdditionalTags ghcr.io/acme/acme-store:latest ` -PushThe generated script:
- builds the image from the generated app root and Dockerfile
- applies the primary
-Imagetag plus any-AdditionalTags - pushes each tag to the registry when
-Pushis supplied
Once the push completes, reuse the same image tag with the generated Kubernetes apply script or another hosted container deployment surface.
Continue into deployment
Section titled “Continue into deployment”After you have a pullable image, continue with:
Those guides keep the image reference explicit instead of rebuilding different images for each deploy target.
Optional repo-native validation script
Section titled “Optional repo-native validation script”To replay the generated container-image baseline from the Cephalon repository in one command, run:
pwsh ./scripts/validate-generated-app-container-image.ps1That script:
- scaffolds a fresh app through
Cephalon.Cli - seeds
./.cephalon/packageswith repo-local package artifacts - validates that the generated app root contains the shipped Docker and container-image assets
- previews the generated build/push contract
- builds the generated container image through the shipped publish script
- by default, starts a local Docker registry and proves that the shipped publish script can push the generated tags into that registry
- tears the temporary app and registry back down afterward unless
-KeepOutputis supplied