Single dockerfiles GitHub repository + Docker Hub automated builds
up vote
1
down vote
favorite
I would like to create a dockerfiles
repository on GitHub to centralize all custom Dockerfile
s I've created so far. I also would like to automatize builds of each image on Docker Hub, independently.
There is many repositories like this on GitHub :
- https://github.com/tianon/dockerfiles
- https://github.com/vimagick/dockerfiles
(I would not talk here about the most starred repository : https://github.com/jessfraz/dockerfiles, because as you can see on Docker Hub, these are not automated builds)
Wanted structure of dockerfiles
repository
I'd like my dockerfiles
GitHub repository have the following structure (branch master
), based on GitHub repositories I mentioned above :
dockerfiles (GitHub repo)
|- docker-image-1
|- Dockerfile
|- docker-image-2
|- Dockerfile
|- ...
Docker Hub builds automation
Configuration
On Docker Hub, I could create 2 public automated builds : docker-image-1
and docker-image-2
, both referring to my dockerfiles
GitHub repository, but with different Build Settings (in fact, only Dockerfile Location differs) :
- for
docker-image-1
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-1/
Docker Tag Name : latest
- for
docker-image-2
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-2/
Docker Tag Name : latest
Drawbacks
With this configuration, all images will be rebuilt if a push on master
branch is made (even if there is only 1 Dockerfile
concerned by the push and Dockerfile Locations are different). I've checked, it seems to be configured like this for vimagick's repository. But I don't think it's the right way (if I'm wrong, tell me).
Of course, in Build Settings of each automated build, I could disable option "When active, builds will happen automatically on pushes" to avoid this, but I'll have to trigger each build manually depending on what Dockerfile
I've updated (not automatic).
Improve automation?
Solutions I see to improve automation are :
- separate each
Dockerfile
in its own GitHub repository. No moredockerfiles
repository, so each one have its own workflow - use a single GitHub repository
dockerfiles
, but with different branches (one per Docker image). Each build could then be configured to be triggered only on the appropriate branch
With these solutions, problem is that I lost a global overview of all my Dockerfile
s. I prefer the idea of a single repository with a single branch, but I don't want all images to be rebuilt on each push on this single branch.
If I'm choosing solution 1, I don't know if git
can help me to keep a single repository dockerfiles
referencing all my repositories, like :
dockerfiles (GitHub repo)
|- docker-image-1 -> link to https://github.com/norbjd/docker-image-1
|- Dockerfile
|- docker-image-2 -> link to https://github.com/norbjd/docker-image-2
|- Dockerfile
It would then be easier to clone the whole project and do Pull Requests (since some images are related : updating docker-image-1/Dockerfile
could lead to update docker-image-2/Dockerfile
). I've read about Git submodules and subtrees, but I don't know if these are appropriate here.
Maybe it's possible with a single repository, and it's just about finding the right Docker Hub Build Settings.
What are the best practices?
git docker dockerhub
add a comment |
up vote
1
down vote
favorite
I would like to create a dockerfiles
repository on GitHub to centralize all custom Dockerfile
s I've created so far. I also would like to automatize builds of each image on Docker Hub, independently.
There is many repositories like this on GitHub :
- https://github.com/tianon/dockerfiles
- https://github.com/vimagick/dockerfiles
(I would not talk here about the most starred repository : https://github.com/jessfraz/dockerfiles, because as you can see on Docker Hub, these are not automated builds)
Wanted structure of dockerfiles
repository
I'd like my dockerfiles
GitHub repository have the following structure (branch master
), based on GitHub repositories I mentioned above :
dockerfiles (GitHub repo)
|- docker-image-1
|- Dockerfile
|- docker-image-2
|- Dockerfile
|- ...
Docker Hub builds automation
Configuration
On Docker Hub, I could create 2 public automated builds : docker-image-1
and docker-image-2
, both referring to my dockerfiles
GitHub repository, but with different Build Settings (in fact, only Dockerfile Location differs) :
- for
docker-image-1
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-1/
Docker Tag Name : latest
- for
docker-image-2
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-2/
Docker Tag Name : latest
Drawbacks
With this configuration, all images will be rebuilt if a push on master
branch is made (even if there is only 1 Dockerfile
concerned by the push and Dockerfile Locations are different). I've checked, it seems to be configured like this for vimagick's repository. But I don't think it's the right way (if I'm wrong, tell me).
Of course, in Build Settings of each automated build, I could disable option "When active, builds will happen automatically on pushes" to avoid this, but I'll have to trigger each build manually depending on what Dockerfile
I've updated (not automatic).
Improve automation?
Solutions I see to improve automation are :
- separate each
Dockerfile
in its own GitHub repository. No moredockerfiles
repository, so each one have its own workflow - use a single GitHub repository
dockerfiles
, but with different branches (one per Docker image). Each build could then be configured to be triggered only on the appropriate branch
With these solutions, problem is that I lost a global overview of all my Dockerfile
s. I prefer the idea of a single repository with a single branch, but I don't want all images to be rebuilt on each push on this single branch.
If I'm choosing solution 1, I don't know if git
can help me to keep a single repository dockerfiles
referencing all my repositories, like :
dockerfiles (GitHub repo)
|- docker-image-1 -> link to https://github.com/norbjd/docker-image-1
|- Dockerfile
|- docker-image-2 -> link to https://github.com/norbjd/docker-image-2
|- Dockerfile
It would then be easier to clone the whole project and do Pull Requests (since some images are related : updating docker-image-1/Dockerfile
could lead to update docker-image-2/Dockerfile
). I've read about Git submodules and subtrees, but I don't know if these are appropriate here.
Maybe it's possible with a single repository, and it's just about finding the right Docker Hub Build Settings.
What are the best practices?
git docker dockerhub
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I would like to create a dockerfiles
repository on GitHub to centralize all custom Dockerfile
s I've created so far. I also would like to automatize builds of each image on Docker Hub, independently.
There is many repositories like this on GitHub :
- https://github.com/tianon/dockerfiles
- https://github.com/vimagick/dockerfiles
(I would not talk here about the most starred repository : https://github.com/jessfraz/dockerfiles, because as you can see on Docker Hub, these are not automated builds)
Wanted structure of dockerfiles
repository
I'd like my dockerfiles
GitHub repository have the following structure (branch master
), based on GitHub repositories I mentioned above :
dockerfiles (GitHub repo)
|- docker-image-1
|- Dockerfile
|- docker-image-2
|- Dockerfile
|- ...
Docker Hub builds automation
Configuration
On Docker Hub, I could create 2 public automated builds : docker-image-1
and docker-image-2
, both referring to my dockerfiles
GitHub repository, but with different Build Settings (in fact, only Dockerfile Location differs) :
- for
docker-image-1
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-1/
Docker Tag Name : latest
- for
docker-image-2
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-2/
Docker Tag Name : latest
Drawbacks
With this configuration, all images will be rebuilt if a push on master
branch is made (even if there is only 1 Dockerfile
concerned by the push and Dockerfile Locations are different). I've checked, it seems to be configured like this for vimagick's repository. But I don't think it's the right way (if I'm wrong, tell me).
Of course, in Build Settings of each automated build, I could disable option "When active, builds will happen automatically on pushes" to avoid this, but I'll have to trigger each build manually depending on what Dockerfile
I've updated (not automatic).
Improve automation?
Solutions I see to improve automation are :
- separate each
Dockerfile
in its own GitHub repository. No moredockerfiles
repository, so each one have its own workflow - use a single GitHub repository
dockerfiles
, but with different branches (one per Docker image). Each build could then be configured to be triggered only on the appropriate branch
With these solutions, problem is that I lost a global overview of all my Dockerfile
s. I prefer the idea of a single repository with a single branch, but I don't want all images to be rebuilt on each push on this single branch.
If I'm choosing solution 1, I don't know if git
can help me to keep a single repository dockerfiles
referencing all my repositories, like :
dockerfiles (GitHub repo)
|- docker-image-1 -> link to https://github.com/norbjd/docker-image-1
|- Dockerfile
|- docker-image-2 -> link to https://github.com/norbjd/docker-image-2
|- Dockerfile
It would then be easier to clone the whole project and do Pull Requests (since some images are related : updating docker-image-1/Dockerfile
could lead to update docker-image-2/Dockerfile
). I've read about Git submodules and subtrees, but I don't know if these are appropriate here.
Maybe it's possible with a single repository, and it's just about finding the right Docker Hub Build Settings.
What are the best practices?
git docker dockerhub
I would like to create a dockerfiles
repository on GitHub to centralize all custom Dockerfile
s I've created so far. I also would like to automatize builds of each image on Docker Hub, independently.
There is many repositories like this on GitHub :
- https://github.com/tianon/dockerfiles
- https://github.com/vimagick/dockerfiles
(I would not talk here about the most starred repository : https://github.com/jessfraz/dockerfiles, because as you can see on Docker Hub, these are not automated builds)
Wanted structure of dockerfiles
repository
I'd like my dockerfiles
GitHub repository have the following structure (branch master
), based on GitHub repositories I mentioned above :
dockerfiles (GitHub repo)
|- docker-image-1
|- Dockerfile
|- docker-image-2
|- Dockerfile
|- ...
Docker Hub builds automation
Configuration
On Docker Hub, I could create 2 public automated builds : docker-image-1
and docker-image-2
, both referring to my dockerfiles
GitHub repository, but with different Build Settings (in fact, only Dockerfile Location differs) :
- for
docker-image-1
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-1/
Docker Tag Name : latest
- for
docker-image-2
:
Type : Branch
Name : master
Dockerfile Location : /docker-image-2/
Docker Tag Name : latest
Drawbacks
With this configuration, all images will be rebuilt if a push on master
branch is made (even if there is only 1 Dockerfile
concerned by the push and Dockerfile Locations are different). I've checked, it seems to be configured like this for vimagick's repository. But I don't think it's the right way (if I'm wrong, tell me).
Of course, in Build Settings of each automated build, I could disable option "When active, builds will happen automatically on pushes" to avoid this, but I'll have to trigger each build manually depending on what Dockerfile
I've updated (not automatic).
Improve automation?
Solutions I see to improve automation are :
- separate each
Dockerfile
in its own GitHub repository. No moredockerfiles
repository, so each one have its own workflow - use a single GitHub repository
dockerfiles
, but with different branches (one per Docker image). Each build could then be configured to be triggered only on the appropriate branch
With these solutions, problem is that I lost a global overview of all my Dockerfile
s. I prefer the idea of a single repository with a single branch, but I don't want all images to be rebuilt on each push on this single branch.
If I'm choosing solution 1, I don't know if git
can help me to keep a single repository dockerfiles
referencing all my repositories, like :
dockerfiles (GitHub repo)
|- docker-image-1 -> link to https://github.com/norbjd/docker-image-1
|- Dockerfile
|- docker-image-2 -> link to https://github.com/norbjd/docker-image-2
|- Dockerfile
It would then be easier to clone the whole project and do Pull Requests (since some images are related : updating docker-image-1/Dockerfile
could lead to update docker-image-2/Dockerfile
). I've read about Git submodules and subtrees, but I don't know if these are appropriate here.
Maybe it's possible with a single repository, and it's just about finding the right Docker Hub Build Settings.
What are the best practices?
git docker dockerhub
git docker dockerhub
asked Nov 8 at 14:05
norbjd
1,1771422
1,1771422
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53209370%2fsingle-dockerfiles-github-repository-docker-hub-automated-builds%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown