Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker image versions #187

Closed
ociotec opened this issue Jun 4, 2021 · 13 comments · Fixed by #190
Closed

Support docker image versions #187

ociotec opened this issue Jun 4, 2021 · 13 comments · Fixed by #190

Comments

@ociotec
Copy link

ociotec commented Jun 4, 2021

Hi, first of all thanks for your work! we do really enjoy using your tool for planning poker sessions :)

Is there any plan to create docker image versions as it's done in other images? I mean, typically each time a project makes a new release with docker image support a new image version is also released...

This is very useful to point to an specific version of the docker image, instead of pointing to "latest".

Thanks in advance.

@xeronimus
Copy link
Contributor

Hey there, thanks for the suggestion, should not be a problem..

Currently i'm on vacation. I can look into it next week.

@ociotec
Copy link
Author

ociotec commented Jun 5, 2021

Thanks!!!!

@xeronimus
Copy link
Contributor

xeronimus commented Jun 14, 2021

Hey @ociotec ,

I'm not the docker expert, so I'm glad for any input.

our build script (also run on travis on every push) builds a docker image and pushes it to the docker registry: https://hub.docker.com/r/xeronimus/poinz

always tagged with "latest".

If I understand correctly, this is done in the script https://github.com/Zuehlke/poinz/blob/master/build/dockerImage.js, line 99

 const cmdArgs = `build -t ${userAndProject}:latest -t ${HEROKU_DEPLOYMENT_TAG} .`;

so, in order to publish a correctly tagged image, we would need to change that to:
"if on master branch, tag the image (additionaly) with the current version from package.json"

if(gitInfo.branch === 'master'){
 const cmdArgs = `build -t ${userAndProject}:latest -t ${HEROKU_DEPLOYMENT_TAG} -t ${pkg.version}.`;
}

Am I on the right track?

@ociotec
Copy link
Author

ociotec commented Jun 14, 2021

Hi, almost on track… you need to put the registry +image path before the image version:

if(gitInfo.branch === 'master'){
 const cmdArgs = `build -t ${userAndProject}:latest -t ${HEROKU_DEPLOYMENT_TAG} -t ${userAndProject}:${pkg.version} .`;
}

This should be done only when there is a tag on master I guess… not sure how to do it on your CI setup…

@ociotec
Copy link
Author

ociotec commented Jun 14, 2021

Then of course you also need to push both images (latest & the tag one), this should be done in two different docker push commands (annoyingly there is no way to combine several pushes into one command as it’s possible with docker build).

@xeronimus
Copy link
Contributor

xeronimus commented Jun 14, 2021

could you propose the change to the travis.yml file?

assuming, the build script tags the (same?) image with "xeronimus/poinz:latest" and "xeronimus/poinz:0.11.3"

@ociotec
Copy link
Author

ociotec commented Jun 14, 2021

I’m not sure about Travis syntax… according to info at https://docs.travis-ci.com/user/deployment#conditional-releases-with-on maybe it’s something like this:

after_success:
  - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
      docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD";
      if [ "$TRAVIS_TAG" == "" ]; then
        VERSION="latest"
      else
        VERSION="$TRAVIS_TAG"
      fi
      docker push xeronimus/poinz:$VERSION;
    fi

xeronimus pushed a commit that referenced this issue Jun 15, 2021
…r branch. push "latest" and "[version]" to docker hub...
@xeronimus xeronimus changed the title Suppor docker image versions Support docker image versions Jun 15, 2021
xeronimus pushed a commit that referenced this issue Jun 15, 2021
…ere was a "recent" change regarding the default behavior

up until v0.9.1, docker pushed all tags by default. after that, the option "--all-tags" was introduced. default is now pushing only the "latest" image.

docker/cli#2220
xeronimus pushed a commit that referenced this issue Jun 15, 2021
xeronimus pushed a commit that referenced this issue Jun 15, 2021
xeronimus pushed a commit that referenced this issue Jun 15, 2021
@stawik-mesa
Copy link
Contributor

Hey there, also thank you for this great project. I just opened a PR with a basic implementation of using git tags as image reference. Feedback is always welcome ;)

xeronimus pushed a commit that referenced this issue Jun 15, 2021
@xeronimus xeronimus reopened this Jun 15, 2021
@xeronimus
Copy link
Contributor

thanks @stawik-mesa for the contribution.

you now fetch the version from git tags, no longer from package.json.
So my conclusion, the docker image will be tagged with the version, only if the current commit is tagged in git.

@stawik-mesa
Copy link
Contributor

@xeronimus
Yes that's correct. I can also change it to just tag it with the version from package.json if branch is master.

@stawik-mesa
Copy link
Contributor

But GitHub tags are unique, while a change of the code without a change on the version in the package.json will overwrite the existing tagged image.

@xeronimus
Copy link
Contributor

makes total sense. thanks for clarification.
I would suggest we leave it at that for the moment, and see how it works out.

@xeronimus
Copy link
Contributor

works as expected. image was tagged (0.11.4) and pushed automatically, see https://hub.docker.com/r/xeronimus/poinz/tags?page=1&ordering=last_updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants