Improve building times of IPU docker image (#14934)

This commit is contained in:
otaj 2022-09-29 11:55:12 +02:00 committed by GitHub
parent 7ff297bdff
commit b06f9b7468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -18,6 +18,7 @@ LABEL maintainer="Lightning-AI <https://github.com/Lightning-AI>"
ARG PYTHON_VERSION=3.9
ARG CONDA_VERSION=4.9.2
ARG PYTORCH_VERSION=1.9
SHELL ["/bin/bash", "-c"]
@ -56,13 +57,12 @@ ENV \
COPY environment.yml environment.yml
RUN conda create -y --name $CONDA_ENV python=${PYTHON_VERSION} pytorch=${PYTORCH_VERSION} cudatoolkit=${CUDA_VERSION} -c pytorch && \
conda init bash && \
RUN conda init bash && \
python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'python>=[\d\.]+', 'python=${PYTHON_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \
python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'- pytorch[>=]+[\d\.]+', '# - pytorch=${PYTORCH_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \
python -c "import re ; fname = 'environment.yml' ; req = re.sub(r'- pytorch[>=]+[\d\.]+', '- pytorch=${PYTORCH_VERSION}', open(fname).read()) ; open(fname, 'w').write(req)" && \
python -c "fname = 'environment.yml' ; req = open(fname).readlines() ; open(fname, 'w').writelines([ln for ln in req if not any(n in ln for n in ['pytorch>', 'horovod'])])" && \
cat environment.yml && \
conda env update --file environment.yml && \
conda env create -f environment.yml && \
conda clean -ya && \
rm environment.yml