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

Push to DockerHub? #143

Open
mattwigway opened this issue Jan 26, 2021 · 10 comments
Open

Push to DockerHub? #143

mattwigway opened this issue Jan 26, 2021 · 10 comments
Assignees

Comments

@mattwigway
Copy link
Contributor

There's now a Dockerfile in the r5r repo. It might be useful to set up a GH Actions workflow that would build a docker image and push it to dockerhub on each production release, so people don't have to get R and Java set up on their systems to use r5r.

@rafapereirabr
Copy link
Member

Thanks for the suggestion, Matt. I talked to the team and we like the idea. However, none of us have experience with Docker or Dockerhub yet. It might take a while for us to find time to learn how to do this, but we are open for contributions!

@mattwigway
Copy link
Contributor Author

I can work on this later this month. I don't have permission to add assignees but feel free to assign me.

@dhersz
Copy link
Collaborator

dhersz commented Feb 18, 2021

Hi @mattwigway. I know you volunteered to work on this issue but I thought that playing around with the Dockerfile would be a nice way to get more knowledgeable about docker as a whole.

I updated the Dockerfile to install the stable release of {r5r}, instead of the dev version as it configured before, with some additional tags to install all dependencies and convert installation warnings to error, so the image building process breaks if {r5r} fails to install.

You mentioned pushing the image on every product release. Do you think this current approach suffices it? I don't know if we could stumble upon some caching issues with how the Dockerfile is configured today.

EDIT: You can check the image here. I haven't added any description whatsoever, that will come soon.

@mattwigway
Copy link
Contributor Author

mattwigway commented Feb 18, 2021 via email

@mattwigway
Copy link
Contributor Author

On further consideration, I think the approach described by @dhersz makes sense - that way everything is built from the canonical source on CRAN. We probably can't build the image with GitHub Actions in that case, but that's okay. I do think we should add a command to the Dockerfile that runs download_r5() so that the R5 jar is already available in the image - since the docker /usr/local is ephemeral, not doing this requires re-downloading R5 every time the docker image is run.

@dhersz
Copy link
Collaborator

dhersz commented Feb 22, 2021

Hi @mattwigway. I also liked your idea of setting up an Action to build an image on every tag release. It looks like an elegant way of creating tagged images on Docker, but I still have to figure out how to do so, since I don't have much experience with GitHub Actions either. Still, allowing for the use of old versions of the package could lead to some troubles regarding the R5 version (i.e. version 0.1.0 doesn't work with current R5 version). So we'd at least have to specify which R5 version works with which r5r version, and ideally figure out a way of preventing one to download an incompatible R5 version with download_r5().

While we figure out how to (and if we want to) implement the above approach, I'll add the download_r5() command to the Dockerfile, as per your suggestion. Great idea, thanks!

@dhersz
Copy link
Collaborator

dhersz commented Feb 22, 2021

Suggestion incorporated to Dockerfile in .

I'll still have a look at tag release GitHub Actions to make sure the image remains updated to {r5r} most recent versions.

For it to work with the current Dockerfile, however, I think the tag release must be created after CRAN approval, otherwise it will still resort to the old version (i.e. if the tag release is created just after the push, while CRAN is still reviewing the submission, the image would be built under a new tag name, but would still use the old version, as the most recent would yet to be available on CRAN).

(having said that, the new image is already available on dockerhub)

@mattwigway
Copy link
Contributor Author

mattwigway commented Feb 22, 2021 via email

@ramongss
Copy link

I also liked your idea of setting up an Action to build an image on every tag release. It looks like an elegant way of creating tagged images on Docker, but I still have to figure out how to do so, since I don't have much experience with GitHub Actions either.

Hello @dhersz and @mattwigway, I don't know if you guys still have this issue in mind (since it's been over 3 years), but maybe I have a solution for the Github Actions idea.

I implemented a solution using Github Actions to build and push a Docker Image to Dockerhub upon a new tag release (here). In this case, each new tag will be pushed to Dockerhub as in my case (here). Older releases should probably be pushed manually, but after the implementation they should be updated automatically.

For it to work with the current Dockerfile, however, I think the tag release must be created after CRAN approval, otherwise it will still resort to the old version (i.e. if the tag release is created just after the push, while CRAN is still reviewing the submission, the image would be built under a new tag name, but would still use the old version, as the most recent would yet to be available on CRAN).

About that, maybe it's possible to create a second condition to allow build and push after CRAN approval (perhaps ChatGPT could help us on this one). I also don't have much experience with Github Actions, but I hope my solution could help to solve this issue.

@mattwigway
Copy link
Contributor Author

We could revisit this, but I think it's less relevant now - three years ago it was really difficult to get all the dependencies in place to run r5r, particularly on Mac. Nowadays with Temurin Java releases and a restructured dependency structure within R5 itself it's pretty painless in my experience.

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

No branches or pull requests

4 participants