-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
DockerHub fix #2 #3631
DockerHub fix #2 #3631
Conversation
In the current effort to port to Python 3 #3333 we want the flexibility to use the local infogami (whatever the current local checked out branch is in /vendor/local) or the branch that Python 2 production uses or the master branch that we are trying to get to be fully Python 3 compatible. This complication means that we might not always want the master branch of infogami. Hopefully, we can move quickly to a world where Python 2 is deprecated and we usually want the master branch of infogami. |
Hey @aasifkhan7 , nice work! In docker hub, we can add build environment variables; we could define a |
docker/hooks/post_checkout
Outdated
@@ -0,0 +1,2 @@ | |||
#!/bin/bash | |||
export DOCKER_HUB=TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should TRUE
be uppercase or lowercase?
On the csh or zsh command line, man true
provides a man page but man TRUE
does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't matter, I guess. ifneq
is not a shell "command". I tried with even TRue
and ifneq ($(DOCKER_HUB),TRue)
- works good. (it's string matching, in my opinion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will be OK but try doing the same with false
...
bash
$ if true == "true" ; then echo yes; fi
yes
$ if false == "false" ; then echo yes; fi
<nothing>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried with fAlse
as well. works like string matching for that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bash?!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in bash, but it's easier to write an if using ifeq()
than figuring out its bash equivalent for the Makefile.
@cdrini Added the environment variable and a build hook - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This is looking great :) A few things to test:
Try editing the Dockerfile.oldev
to FROM aasifkhan7/olbase:latest
(what is the link you're pushing to?), then try rebuilding web docker-compose build web
and see if it runs! I think we might need to do the post_checkout
hook as well as the build
hook, because I don't believe the submodules get initialized at all otherwise. (The build won't fail if the submodules aren't initialized, but the site won't run :P)
Hi @aasifkhan7 ! I tried pulling and it worked 🤩 I also confirmed that Hmmm, |
@cdrini I have setup automatic build on dockerhub - no pushing from my computer. 🙂 |
I was getting an error when trying this on my test repo; docker hub said:
I'm trying changing the build hook right now 👍 |
You can set the image name (e.g. olbase) and tags (e.g. latest) from the dockerhub UI; that's what the That might be enough! |
Didn't work :/ Looks like that doesn't set it during build for some reason. Going to try changing build hook to use |
This is needed in order to let us set the build name/tag and dockerfile path from the docker hub UI. See https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm; tested it builds the image, and that the built image can run (not the latest iteration, but a recent one).
Here's the docker hub repo; I'll test a little more, and if it works, update the docs! |
Awesome work here!! Well done @aasifkhan7 |
Closes #3615
@cdrini Seems like DockerHub is itself able to pull the submodules before the any of the steps in Dockerfile are run (effectively doing git pulling of submodules before the docker build)
Hence another solution for this issue, in addition to #3628 might be to add a check - for the sake of checking if DockerHub has already recursively cloned the submodules, and run git submodule commands in
git
rule ofMakefile
only whenvendor/infogami
is empty implying that submodule hasn't yet been cloned (we could have chosen any of the 3 submodules for checking if they're empty, the choice ofvendor/infogami
is entirely random).This seems a better fix to the DockerHub publishing issue rather than the related PR: #3628
I was able to build on publish the image on DockerHub using this.