forked from Project-MONAI/MONAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1956 - docker image building pipelines (Project-MONAI#1957)
* refactor docker building Signed-off-by: Wenqi Li <[email protected]>
- Loading branch information
Showing
5 changed files
with
154 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ docs/ | |
.coverage/ | ||
coverage.xml | ||
.readthedocs.yml | ||
*.md | ||
*.toml | ||
|
||
!README.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: docker | ||
# versioning: compute a static version file | ||
# local_docker: use the version file to build docker images | ||
# docker_test_latest: test the latest internal docker image (has flake) | ||
# docker_test_dockerhub: test the latest dockerhub release (no flake) | ||
on: | ||
# master only docker deployment and quick tests | ||
push: | ||
branches: | ||
- master | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
versioning: | ||
# compute versioning file from python setup.py | ||
# upload as artifact | ||
# (also used in release.yml) | ||
if: github.repository == 'Project-MONAI/MONAI' | ||
container: | ||
image: localhost:5000/local_monai:latest | ||
runs-on: [self-hosted, linux, x64, build_only] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# full history so that we can git describe | ||
with: | ||
ref: master | ||
fetch-depth: 0 | ||
- shell: bash | ||
run: | | ||
git describe | ||
python setup.py build | ||
cat build/lib/monai/_version.py | ||
- name: Upload version | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: _version.py | ||
path: build/lib/monai/_version.py | ||
- name: Clean up directory | ||
shell: bash | ||
run: | | ||
ls -al | ||
rm -rf {*,.[^.]*} | ||
local_docker: | ||
# builds two versions: local_monai:latest and local_monai:dockerhub | ||
# latest: used for local tests | ||
# dockerhub: release, no flake package | ||
if: github.repository == 'Project-MONAI/MONAI' | ||
needs: versioning | ||
runs-on: [self-hosted, linux, x64, build_only] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: master | ||
- name: Download version | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: _version.py | ||
- name: docker_build | ||
shell: bash | ||
run: | | ||
# get tag info for versioning | ||
cat _version.py | ||
mv _version.py monai/ | ||
# build and run original docker image for local registry | ||
docker build -t localhost:5000/local_monai:latest -f Dockerfile . | ||
docker push localhost:5000/local_monai:latest | ||
# build once more w/ tag "latest": remove flake package as it is not needed on hub.docker.com | ||
sed -i '/flake/d' requirements-dev.txt | ||
docker build -t projectmonai/monai:latest -f Dockerfile . | ||
# also push as tag "dockerhub" to local registry | ||
docker image tag projectmonai/monai:latest localhost:5000/local_monai:dockerhub | ||
docker push localhost:5000/local_monai:dockerhub | ||
# distribute as always w/ tag "latest" to hub.docker.com | ||
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin | ||
docker push projectmonai/monai:latest | ||
docker logout | ||
docker_test_latest: | ||
if: github.repository == 'Project-MONAI/MONAI' | ||
needs: local_docker | ||
container: | ||
image: localhost:5000/local_monai:latest | ||
runs-on: [self-hosted, linux, x64, common] | ||
steps: | ||
- name: Import | ||
run: | | ||
python -c 'import monai; monai.config.print_config()' | ||
cd /opt/monai | ||
ls -al | ||
ngc --version | ||
python -m tests.min_tests | ||
env: | ||
QUICKTEST: True | ||
|
||
docker_test_dockerhub: | ||
if: github.repository == 'Project-MONAI/MONAI' | ||
needs: local_docker | ||
container: | ||
image: localhost:5000/local_monai:dockerhub | ||
runs-on: [self-hosted, linux, x64, common] | ||
steps: | ||
- name: Import | ||
run: | | ||
python -c 'import monai; monai.config.print_config()' | ||
cd /opt/monai | ||
ls -al | ||
ngc --version | ||
python -m tests.min_tests | ||
env: | ||
QUICKTEST: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters