Compile e envie a imagem ao publicar uma versão
Automatize as compilações do contêiner quando etiquetar uma versão.
Compile e envie a imagem ao publicar uma versão é uma aula grátis de MLOps Academy no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de MLOps Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de MLOps Academy inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
Build Only on Release
You do not ship an image on every commit. The release step builds and publishes a container only when you mark a version as ready. 📦
Trigger on a Tag
A common pattern fires the build when you push a git tag like v1.2.0, so a deliberate version, not a casual push, starts the deploy.
on:
push:
tags: ["v*"]What a Build Produces
The build packs your model API, its code, and dependencies into one image: a frozen, runnable snapshot that behaves the same on any machine.
A Registry Stores Images
A container registry like GHCR, ECR, or Docker Hub is where built images live so any server can later pull and run them.
Log In With a Secret
Before pushing, the workflow logs into the registry using a stored secret, never a hardcoded password, keeping credentials out of your code.
- uses: docker/login-action@v3
with:
password: ${{ secrets.REGISTRY_TOKEN }}Tag the Image Well
Give the image a clear tag that matches your release version. Reusing latest alone makes it impossible to tell which build is running.
myorg/model-api:v1.2.0Build and Push in One Action
The official Docker build-push action builds your Dockerfile and uploads the result to the registry in a single step.
- uses: docker/build-push-action@v6
with:
push: true
tags: myorg/model-api:v1.2.0Pin the Version, Not latest
Deploying a pinned tag like v1.2.0 means you always know exactly which model and code are live, and you can roll back to an earlier tag fast.
Cache Layers for Speed
Image builds reuse unchanged layers from a cache, so only the parts you actually changed rebuild. This keeps release builds quick.
Deploy Pulls the Image
Once pushed, your runtime simply pulls the tagged image and starts it. The same artifact you tested is the one that goes live, byte for byte.
docker pull myorg/model-api:v1.2.0Release Notes Close the Loop
Tie the image tag to a GitHub release with notes on what changed. Now anyone can trace a running container back to its exact code and model.
Quick Check
Why tag the released image with a version instead of only latest?
Recap
On a version tag, log in with a secret, build the image, and push it to a registry under a pinned tag. Your runtime pulls that exact artifact to go live.
Perguntas Frequentes
A aula “Compile e envie a imagem ao publicar uma versão” é grátis?
Sim — o texto completo de “Compile e envie a imagem ao publicar uma versão” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de MLOps Academy, atualize para CoddyKit PRO. O curso de MLOps Academy inclui 4 aulas no total.
O que vou aprender em “Compile e envie a imagem ao publicar uma versão”?
Automatize as compilações do contêiner quando etiquetar uma versão. Você pratica MLOps Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar MLOps Academy?
Nenhuma experiência prévia é necessária. MLOps Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.
Quanto tempo leva a aula “Compile e envie a imagem ao publicar uma versão”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de MLOps Academy?
Sim. Cada aula de MLOps Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- O que CI/CD significa para modelos
- Um fluxo de trabalho do GitHub Actions para aprendizado de máquina
- Condicione as incorporações à qualidade do modelo
- Compile e envie a imagem ao publicar uma versão