Skip to content

Dockerfile and Docker automated builds #591

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

Closed
ferrarimarco opened this issue Nov 23, 2017 · 20 comments · Fixed by #634
Closed

Dockerfile and Docker automated builds #591

ferrarimarco opened this issue Nov 23, 2017 · 20 comments · Fixed by #634

Comments

@ferrarimarco
Copy link
Contributor

Hi @olleolleolle

Would you mind accepting a pull request for a Dockerfile? I can also configure a Docker Hub automated build that runs on each tag (even on each commit if that is the desired behaviour).

@olleolleolle
Copy link
Collaborator

olleolleolle commented Nov 23, 2017 via email

@ferrarimarco
Copy link
Contributor Author

Ok, I'm working on it.

How do you publish new releases on Rubygems? I need this info to think about the Dockerfile and the configuration of automated builds

@ferrarimarco
Copy link
Contributor Author

@olleolleolle here it is: #592

@olleolleolle
Copy link
Collaborator

olleolleolle commented Nov 23, 2017

@ferrarimarco I use the rake release Rake task to make new versions? To answer your question.

@ferrarimarco
Copy link
Contributor Author

As soon as (and if) #592 is merged I'll configure the Docker Hub automated build if it's fine for you

olleolleolle pushed a commit that referenced this issue Nov 23, 2017
* Implemented a Dockerfile. See #591

* Set Ferrari Marco as a maintainer

* Explicitly install the latest released version
@ferrarimarco
Copy link
Contributor Author

ferrarimarco commented Nov 23, 2017

Ok I can now configure the Docker automated build. Which prefix should we use for the image? Maybe skywinder to be consistent with this repository

Example: https://hub.docker.com/r/ferrarimarco/liquibase/

@ferrarimarco
Copy link
Contributor Author

@olleolleolle I don't have access to this repo configuration, so I cannot enable the automatic build all by myself.

Let's explore the options:

Automated build with Docker hub

If we want to use (like previously suggested) Docker Hub for builds we should (since skywinder is a user account on GitHub and not GitHub Organization):

  1. Register a new account on Docker Hub (let's call it docker-hub-user in this example)
  2. Link docker-hub-user with github.com/skywinder (anyone doing this must know github.com/skywinder credentials)
  3. Let me add docker-hub-user in the skywinder Docker Hub organization (I created it moments ago)
  4. Use docker-hub-user to create a new automated build from GitHub and choose "skywinder" as namespace when creating it. Since docker-hub-user has been linked to github.com/skywinder, it will have access to this repo
  5. Let me configure the automated build for you (since I'm a member of the skywinder organization I have the rights to do so)

Automated build with Travis CI

Each time a tag is pushed, we use Travis CI to build the Docker image and push it under the skywinder Docker Hub organization. For this we need update the .travis.yml (I can do that) but you (or someone who has the proper rights) should update the Travis build configuration because we need to set the Docker Hub credentials in Travis CI.

This approach has the added benefit that we can use Travis CI environment variables (in our case we are going to use the git tag) to tag the docker image and to pass it as a build time variable instead of hardcoding the version in the Dockerfile.

Note 1: we should run the "build docker image & push to docker-hub" step as the very last, after the gem has been uploaded on Rubygems. So this approach is not suitable if you want to deploy on Rubygems in another context (i.e. not from Travis CI).

Note 2: as said, we should run the "build docker image & push to docker-hub" step only on when a new tag is published on GitHub because the Dockerfile I provided downloads GitHub Changelog Generator from Rubygems and does not compile it from source. It's possible to implement a Dockerfile for this use case (that will work on each commit, pull request and tag), but this is another story (I can help you in this also if needed).

@olleolleolle
Copy link
Collaborator

Skywinder is the GitHub username of a person. (Hi, @skywinder!)

Perhaps the time has arrived when we must use an org?

@ferrarimarco
Copy link
Contributor Author

ferrarimarco commented Nov 23, 2017

I know he's a person :)

I created a skywinder organization on Docker Hub so everyone in that org could manage its Docker images. Otherwise we would have to share the credentials.

And yes, by creating a GitHub organization we could solve this issue.

EDIT: any updates? @olleolleolle @skywinder

@skywinder
Copy link
Member

Hello everyone!
Make sense. Any ideas about naming?
The Same name such as github-changelog-generator?
So it seems we have to create a logo for such a big deal 😉

@ferrarimarco
Copy link
Contributor Author

the same name seems resonable to me 👍

@riuvshin
Copy link

still no automated build for github-changelog-generator ?

docker run -it --rm -v "$(pwd)":/usr/local/src/your-app skywinder/github-changelog-generator fails beacuse there is no such image :)

@ojongerius
Copy link

ojongerius commented Mar 27, 2018

Hey there! Any luck with this work? There is an image, https://hub.docker.com/r/skywinder exists. Just a matter of adding this repository, no?

For folks who do not like pulling random peoples repository, a poor man suggestion that keeps your system clean:

git clone git@github.com:skywinder/github-changelog-generator.git &&cd github-changelog-generator
docker build -t skywinder/github-changelog-generator - < Dockerfile
cd -
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app skywinder/github-changelog-generator -u github_username -p github_project

@olleolleolle
Copy link
Collaborator

@ojongerius Would you care to put those words into a PR to the README?

@ferrarimarco
Copy link
Contributor Author

@ojongerius https://hub.docker.com/r/skywinder was created before #595
It will be deleted in the coming days (otherwise @skywinder would have his username already taken on Docker Hub).

@ferrarimarco
Copy link
Contributor Author

@olleolleolle @skywinder if we want to move ahead before #595, we have some alternatives (but let's wait for the deletion of skywinder organization I asked today):

  1. @skywinder could register an account on Docker Hub, create a github-changelog-generator repository and grant me access to it as a collaborator to that repo and to the Travis build so I can set things up
  2. I could setup a Docker Hub repository (ferrarimarco/github-changelog-generator) in sync with this repo and then when Move repo to organisation #595 is completed we can create the corresponding organization on Docker Hub and move ferrarimarco/github-changelog-generator to that organization

@olleolleolle
Copy link
Collaborator

@ferrarimarco Do you want to shepherd the Docker parts? Welcome! Awesome. 2 is a good option, then!

@ferrarimarco
Copy link
Contributor Author

@ojongerius
Copy link

ojongerius commented Mar 28, 2018

@ferrarimarco could you please update the README to use that url instead of the current broken link?

Also, thank you for Dockerising this!

@ferrarimarco
Copy link
Contributor Author

there is a PR for that #634

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.

5 participants