-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix github resource issue when build latest docker #7450
Conversation
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
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.
This is going to back to what we had before with deleting the whole directory so it should be fine. Deleting the whole hostedtoolcache
directory won't have the Python version issue you addressed earlier?
Hi @ericspod,
Yes, since this task is based on the base PyTorch image, I believe we could be able to remove the entire directory without worrying about the Python version inside the Docker image. But delete whole dir still can't solve the issue, I guess it may due to the update of the PyTorch. Do you have any suggestion? |
We might have to poke around in the image to see what else we can delete to reduce its size. Within apt update
apt install ncdu
ncdu / You can use this to browse around and see what can be removed. Maybe we can delete everything in |
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
After a deeper investigation, there is no more space to free up. I discussed this with @YanxuanLiu offline, and he will help move the build docker workflow from GitHub to Blossom. cc @ericspod, do you have any concerns about this update? |
It would be easier to keep the docker build on github of course. Is this actually an issue with the space in the runner itself? The Dockerfile could use optimising to produce fewer layers than is present now, or use a multi-stage build process. This should save space and make a smaller final image. |
This may reduce the number of layers. I haven't checked it thoroughly but it may help to update the Dockerfile with something like this: # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To build with a different base image
# please run `docker build` using the `--build-arg PYTORCH_IMAGE=...` flag.
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:23.08-py3
FROM ${PYTORCH_IMAGE} as build
LABEL maintainer="[email protected]"
WORKDIR /opt/monai
COPY LICENSE CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md versioneer.py setup.py setup.cfg runtests.sh \
MANIFEST.in requirements-min.txt requirements.txt requirements-dev.txt ./
COPY tests ./tests
COPY monai ./monai
# install full deps
RUN awk '!/torch/' requirements.txt > /tmp/tmp \
&& mv /tmp/tmp requirements.txt\
&& python -m pip install --upgrade --no-cache-dir pip \
&& python -m pip install --no-cache-dir -r requirements-dev.txt
# compile ext and remove temp files
# 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...
RUN BUILD_MONAI=1 FORCE_CUDA=1 python setup.py develop \
&& rm -rf build __pycache__
# NGC Client
ARG NGC_CLI_URI="https://ngc.nvidia.com/downloads/ngccli_linux.zip"
WORKDIR /opt/tools
RUN wget -q ${NGC_CLI_URI} && unzip ngccli_linux.zip && chmod u+x ngc-cli/ngc && \
find ngc-cli/ -type f -exec md5sum {} + | LC_ALL=C sort | md5sum -c ngc-cli.md5 && \
rm -rf ngccli_linux.zip ngc-cli.md5
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y libopenslide0 zip \
&& rm -rf /var/lib/apt/lists/*
# append /opt/tools to runtime path for NGC CLI to be accessible from all file system locations
ENV PATH=${PATH}:/opt/tools:/opt/tools/ngc-cli
WORKDIR /opt
RUN zip -r opt.zip ./monai ./tools/ngc-cli
# create a final stage with fewer layers
FROM ${PYTORCH_IMAGE} as final
WORKDIR /opt
COPY --from=build /opt/opt.zip .
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y libopenslide0 zip \
&& unzip opt.zip \
&& python -m pip install --upgrade --no-cache-dir pip \
&& (cd monai && python -m pip install --no-cache-dir -r requirements-dev.txt) \
&& rm -rf opt.zip /var/lib/apt/lists/*
WORKDIR /opt/monai |
Signed-off-by: YunLiu <[email protected]>
for more information, see https://pre-commit.ci
Hi @ericspod, thanks for your suggestions, I tried but it's still not working. |
Thanks @KumoLiu, I guess there's not much that we can do if the first operation creates this much data. Even using |
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
for more information, see https://pre-commit.ci
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 good as a fix, we will come back to this later if possible.
/build |
Fixes Project-MONAI#7449 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: YunLiu <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Juan Pablo de la Cruz Gutiérrez <[email protected]>
Fixes Project-MONAI#7449 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: YunLiu <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Yu0610 <[email protected]>
Fixes #7449
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.