-
Notifications
You must be signed in to change notification settings - Fork 1.1k
100 lines (94 loc) · 3 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# this is the docker image releasing pipeline, pushing to https://hub.docker.com/r/projectmonai/monai
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:
# dev only docker deployment and quick tests
push:
branches:
- dev
# Allows you to run this workflow manually from the Actions tab
# This is to trigger building/testing docker image from dev only.
workflow_dispatch:
jobs:
versioning_dev:
# compute versioning file from python setup.py
# upload as artifact
if: github.repository == 'Project-MONAI/MONAI'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# full history so that we can git describe
with:
ref: dev
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- shell: bash
run: |
git describe
python -m pip install -U pip wheel setuptools
python setup.py build
cat build/lib/monai/_version.py
- name: Upload version
uses: actions/upload-artifact@v3
with:
name: _version.py
path: build/lib/monai/_version.py
- name: Clean up directory
shell: bash
run: |
ls -al
rm -rf {*,.[^.]*}
docker_build_dev:
# builds projectmonai/monai:latest
if: github.repository == 'Project-MONAI/MONAI'
needs: versioning_dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: dev
- name: Download version
uses: actions/download-artifact@v3
with:
name: _version.py
- name: docker_build
shell: bash
run: |
rm -rf /opt/hostedtoolcache
docker --version
# get tag info for versioning
cat _version.py
mv _version.py monai/
# build "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 .
# 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 image prune -f
docker_test_dockerhub:
if: github.repository == 'Project-MONAI/MONAI'
needs: docker_build_dev
container:
image: docker://projectmonai/monai:latest
options: "--shm-size=4g --ipc=host"
runs-on: [self-hosted, linux, X64, docker]
steps:
- name: Import
run: |
export CUDA_VISIBLE_DEVICES= # cpu-only
python -c 'import monai; monai.config.print_debug_info()'
cd /opt/monai
ls -al
ngc --version
./runtests.sh --min
shell: bash
env:
QUICKTEST: True