-
Notifications
You must be signed in to change notification settings - Fork 531
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
ENH: generate Dockerfiles with neurodocker + migrate to CircleCI 2.0 #2202
Conversation
Rename base.Dockerfile to Dockerfile.base to conform to moby style. For now, the master Neurodocker Docker image is used, but a versioned image will be used once a newer Neurodocker version is released.
The specification for CircleCI 2.0 is stored in `.circleci/config.yml` instead of in `circle.yml`. Todo: - Run tests. For now, images are built and pushed, but no tests are run. - Minimize containers with neurodocker reprozip. This functionality will be updated soon. See discussion in VIDA-NYU/reprozip#274.
Please see https://circleci.com/gh/kaczmarj/nipype/182 for an example of the CircleCI run on my fork. |
docker/generate_dockerfiles.sh
Outdated
fusefat g++ git graphviz make ruby unzip xvfb \ | ||
--add-to-entrypoint "source /etc/fsl/fsl.sh" \ | ||
--env ANTSPATH='/usr/lib/ants' PATH='/usr/lib/ants:$PATH' \ | ||
--c3d version=1.0.0 \ |
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.
the latest version of convert3d might be available in neurodebian
@kaczmarj - please make sure to merge with master, when sending an update. |
@satra - i'll be sure to do that. i am waiting on VIDA-NYU/reprozip#281. At the moment, |
- install dependency codecov - update nipype/info.py if CIRCLE_TAG is set - retry docker image builds - download test data - fix workdir permission denied issue - save all docker images to single tarball - pipe dockerhub password to `docker login` - push all docker images to docker hub on success
Use this file to prune Dockerfiles before getting their hash. - remove empty lines, comments, and timestamp
In an effort to complete this PR in time for the release of version 0.14, minimizing containers with ReproZip will be done in a separate PR. The tests might have to be re-balanced in another PR. Does it seem reasonable to use CircleCI's option to rebuild without cache to force a rebuild of the base Docker image? Notes
|
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.
looks pretty nice - thanks!
.circleci/config.yml
Outdated
|
||
compare_base_dockerfiles: | ||
docker: | ||
- image: docker:17.09.0-ce-git |
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.
could we update this to 17.10.0-ce
for the chown flag
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.
that's a good point, although the change would be in the machine executor of build_and_test
. i can change that to circleci/classic:201710-02
(more info on machine executors).
.circleci/config.yml
Outdated
ash prune_dockerfile.sh Dockerfile.base > /tmp/docker/Dockerfile.base-pruned | ||
- restore_cache: | ||
# TODO: change this to 'master' after we are sure this works. | ||
key: dftest-v5-enh/circleci-neurodocker-{{ checksum "/tmp/docker/Dockerfile.base-pruned" }} |
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.
does this need to be changed now?
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.
yes i will change this
.circleci/config.yml
Outdated
# TODO: remove `docker pull` once once caching works. | ||
command: | | ||
# bash /tmp/docker/get_base_image.sh | ||
docker pull kaczmarj/nipype:base |
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.
todo?
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.
also has to be changed. this was in place to cut down on testing time when base docker image didn't change but the cache wasn't set yet
.circleci/config.yml
Outdated
e=1 && for i in {1..5}; do | ||
docker build \ | ||
--rm=false \ | ||
--tag kaczmarj/nipype:latest \ |
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.
nipype/nipype
.circleci/config.yml
Outdated
e=1 && for i in {1..5}; do | ||
docker build \ | ||
--rm=false \ | ||
--tag kaczmarj/nipype:py27 \ |
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.
nipype/nipype
.circleci/config.yml
Outdated
no_output_timeout: 120m | ||
command: | | ||
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin | ||
docker push kaczmarj/nipype:base |
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.
nipype/nipype
.circleci/config.yml
Outdated
filters: | ||
branches: | ||
# TODO: change this to master after we are sure this works. | ||
only: enh/circleci-neurodocker |
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.
whoo!
.circleci/tests.sh
Outdated
fi | ||
|
||
# TODO: change this image name | ||
DOCKER_IMAGE="kaczmarj/nipype" |
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.
ping here
Dockerfile
Outdated
|
||
COPY ["docker/files/run_builddocs.sh", "docker/files/run_examples.sh", "docker/files/run_pytests.sh", "nipype/external/fsl_imglob.py", "/usr/bin/"] |
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 don't feel too strongly about changing this, but maybe we can take advantage of --chown
flag now
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.
yes we can do that. although this would require an update to neurodocker. could this be done in a future pr?
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.
yes
docker/generate_dockerfiles.sh
Outdated
# neurodebian:stretch-non-free pulled on November 3, 2017 | ||
BASE_IMAGE="neurodebian@sha256:7590552afd0e7a481a33314724ae27f76ccedd05ffd7ac06ec38638872427b9b" | ||
|
||
NIPYPE_BASE_IMAGE="kaczmarj/nipype:base" |
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.
nipype/nipype
- use master branch for caching - replace kaczmarj/nipype with nipype/nipype - reset cache prefixes - use latest docker (v17.10.0-ce) containers and machine - use environment variable to determine whether to pull or build base image - save docker images to tar.gz if on master branch (deploying) - use fastest gzip compression (gives good ratio of speed/compression)
i think this looks good - one question: since we are generating the dockerfile do we need to store it? |
The Dockerfiles are not generated during the testing. I was thinking that someone would generate the Dockerfiles if needed, commit the changes, and push. The testing would use those Dockerfiles. Do you want CircleCI to generate the Dockerfiles? |
@kaczmarj - since the testing uses docker and has a script that generates the dockerfile, can't that be generated during testing rather than being in the repo? |
That makes sense. Should both the base and main Dockerfiles be generated in CircleCI? Or would you like to have the main Dockerfile in the repo? |
i think anything that can be generated should be generated otherwise it can go out of sync. |
9f6544f
to
a189fb5
Compare
- do not store dockerfiles in repo - cache base dockerfile in deploy step that was generated in `compare_base_dockerfiles` step - use global `working_directory`
a189fb5
to
28547cc
Compare
@satra - dockerfiles are generated in CircleCI now, and I removed them from the repo. I should also mention that If the base Dockerfile is ever reverted to a previous cached version, the CircleCI cache prefix (i.e., If the base Dockerfile is reverted to be the same (identical, not considering comments and empty lines) as a previous, cached base Dockerfile, the old cached Dockerfile will be found and the current base Docker image will be pulled. This is not desirable, but it happens because CircleCI's caches are immutable. |
@kaczmarj don't forget to add yourself to the |
Fixes #2144.
Changes proposed in this pull request:
Addresses (or will address) these items from the original issue:
Other changes:
This is a work-in-progress. It would be great to have some feedback on what I have so far, namely dockerfile generation and the migration to circleci 2.0.
Parts of the code refer to my personal dockerhub repo (
kaczmarj/nipype
) but those will be changed when this PR is closer to complete. Also, themaster
neurodocker docker image is used now, but I will change this tov0.3.2
once I release that version.I am in the process of reworking neurodocker-reprozip's container-minimization functionality (VIDA-NYU/reprozip#274). I hope to finish that soon for this PR. I have already added a command to merge reprozip pack files (ReproNim/neurodocker#69).
Just to note, I propose using
neurodebian:stretch-non-free
as the base image, instead ofubuntu:xenial-20161213
.Todo
generate dockerfiles using neurodockerbuild docker image if needed or reload minimized image