Build tagged images on git tags
See original GitHub issueCurrently our workflow looks like this:
release-image:
stage: deploy
script:
- docker build -t "$CONTAINER_RELEASE_IMAGE"
--build-arg DJANGO_ENV=production -f docker/django/Dockerfile .
- docker push "$CONTAINER_RELEASE_IMAGE"
only:
- master
environment:
name: production # used to track time with 'cycle analytics'
Where CONTAINER_RELEASE_IMAGE
equals to "$REGISTRY/$GROUP_NAME/$PROJECT_NAME:latest"
.
But, that an anti-pattern. Because we always use latest
for version numbers. There’s no default way to build versioned images like: "$REGISTRY/$GROUP_NAME/$PROJECT_NAME:3.5"
.
And I suggest to fix it with git tag
. I already use it in our workflow, we just need to set appropriate tag names when new tag
is pushed. We can use CI_COMMIT_TAG
with a simple condition. https://docs.gitlab.com/ee/ci/variables/
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Build Docker images for git tags (releases) on CI #70 - GitHub
On every new git tag, we should build a Docker image with tag matching git tag without leading v , and also tag...
Read more >Git - Tagging - Git SCM
In this section, you'll learn how to list existing tags, how to create and delete tags, and what the different types of tags...
Read more >Add a tag to a Docker image if there's a git tag using GitHub ...
The first step generates the list of tags and the second build/push. if $GITHUB_REF starts by refs/tags/ it is a tag and as...
Read more >How do you tag docker images? - Andy Dote
An interesting question came up at work today: how do you tag your Docker images? In previous projects, I've always used a short...
Read more >Github Tags - Tools QA
Tags are much more than tagging the commits as we did in Git. ... Now the image of the repository you see is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This might help to integrate several services together. There are usecases when other images require different image versions.
Like microservices, frontend/backed, etc. I will experiment with it soon enough.
I’d also suggest to use anchors like this