From 3e5fef71fa218851041c266a4190f9039639388f Mon Sep 17 00:00:00 2001 From: Isaac Yang Date: Thu, 7 Jan 2021 10:31:22 -0800 Subject: [PATCH 1/2] Improve docker build process COPY only needed Fix LICENSE Verify the tests in docker still works Add MAINFEST.in, .gitignore and .gitattributes Signed-off-by: Isaac Yang --- .dockerignore | 12 ++++++++++++ .github/workflows/cron.yml | 1 + Dockerfile | 7 +++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..549e63bad5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +# Ignore the following files/folders during docker build + +__pycache__/ +docs/ + +.coverage +.readthedocs.yml +*.md +*.toml + +!README.md + diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 4fc90ca520..d9ffdb7f5e 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -61,6 +61,7 @@ jobs: runs-on: [self-hosted, linux, x64, common] steps: - name: Run tests report coverage + # The docker image process has done the compilation. BUILD_MONAI=1 may not be necessary. run: | cd /opt/monai nvidia-smi diff --git a/Dockerfile b/Dockerfile index 60460fd1a5..f3cc1a9aff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,6 @@ FROM ${PYTORCH_IMAGE} MAINTAINER MONAI Consortium WORKDIR /opt/monai -ENV PATH=/opt/tools:${PATH} # install full deps COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/ @@ -28,7 +27,11 @@ RUN cp /tmp/requirements.txt /tmp/req.bak \ # TODO: remark for issue [revise the dockerfile #1276](https://github.com/Project-MONAI/MONAI/issues/1276) # please specify exact files and folders to be copied -- else, basically always, the Docker build process cannot cache # this or anything below it and always will build from at most here; one file change leads to no caching from here on... -COPY . . + +COPY LICENSE setup.py setup.cfg versioneer.py runtests.sh .gitignore .gitattributes MANIFEST.in ./ +COPY tests ./tests +COPY monai ./monai +COPY .git ./.git RUN BUILD_MONAI=1 FORCE_CUDA=1 python setup.py develop \ && rm -rf build __pycache__ From 35850fbe49395a04cd7d669c4da9ddd3ad33e9b6 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Thu, 7 Jan 2021 21:10:53 +0000 Subject: [PATCH 2/2] MANIFEST.in requires README.md, adding it in dockerfile Signed-off-by: Wenqi Li --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f3cc1a9aff..9430db076b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ RUN cp /tmp/requirements.txt /tmp/req.bak \ # please specify exact files and folders to be copied -- else, basically always, the Docker build process cannot cache # this or anything below it and always will build from at most here; one file change leads to no caching from here on... -COPY LICENSE setup.py setup.cfg versioneer.py runtests.sh .gitignore .gitattributes MANIFEST.in ./ +COPY LICENSE setup.py setup.cfg versioneer.py runtests.sh .gitignore .gitattributes README.md MANIFEST.in ./ COPY tests ./tests COPY monai ./monai COPY .git ./.git