Remove unnecessary intermediate layers in base-conda Dockerfile (#5697)

* [docker][base-conda] Combine ENV+COPY instructions

* [docker][base-cuda] Combine ENV+COPY instructions

* [docker][base-xla] Combine ENV+COPY instructions

* [docker][base-cuda] Fix COPY instruction

* [docker][base-xla] Fix quote in ENV

* [docker][base-xla] Fix $PATH in ENV

* [docker][base-conda] Fix COPY instruction

* chlog

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
This commit is contained in:
Sumanth Ratna 2021-01-29 07:27:18 -05:00 committed by Jirka Borovec
parent a7d288cb31
commit 8732475701
4 changed files with 47 additions and 40 deletions

View File

@ -198,6 +198,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed a race condition in `ModelCheckpoint` when checking if a checkpoint file exists ([#5144](https://github.com/PyTorchLightning/pytorch-lightning/pull/5144))
- Remove unnecessary intermediate layers in Dockerfiles ([#5697](https://github.com/PyTorchLightning/pytorch-lightning/pull/5697))
## [1.1.6] - 2021-01-26

View File

@ -58,21 +58,21 @@ RUN apt-get update -qq && \
rm -rf /root/.cache && \
rm -rf /var/lib/apt/lists/*
ENV PATH="/root/miniconda3/bin:$PATH"
ENV LD_LIBRARY_PATH="/root/miniconda3/lib:$LD_LIBRARY_PATH"
ENV CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda"
ENV \
PATH="/root/miniconda3/bin:$PATH" \
LD_LIBRARY_PATH="/root/miniconda3/lib:$LD_LIBRARY_PATH" \
CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda" \
HOROVOD_GPU_OPERATIONS=NCCL \
HOROVOD_WITH_PYTORCH=1 \
HOROVOD_WITHOUT_TENSORFLOW=1 \
HOROVOD_WITHOUT_MXNET=1 \
HOROVOD_WITH_GLOO=1 \
HOROVOD_WITHOUT_MPI=1 \
# MAKEFLAGS="-j$(nproc)" \
MAKEFLAGS="-j1" \
TORCH_CUDA_ARCH_LIST="3.7;5.0;6.0;7.0;7.5" \
CONDA_ENV=lightning
ENV HOROVOD_GPU_OPERATIONS=NCCL
ENV HOROVOD_WITH_PYTORCH=1
ENV HOROVOD_WITHOUT_TENSORFLOW=1
ENV HOROVOD_WITHOUT_MXNET=1
ENV HOROVOD_WITH_GLOO=1
ENV HOROVOD_WITHOUT_MPI=1
#ENV MAKEFLAGS="-j$(nproc)"
ENV MAKEFLAGS="-j1"
ENV TORCH_CUDA_ARCH_LIST="3.7;5.0;6.0;7.0;7.5"
ENV CONDA_ENV=lightning
COPY environment.yml environment.yml
# conda init
@ -89,10 +89,11 @@ RUN conda create -y --name $CONDA_ENV python=${PYTHON_VERSION} pytorch=${PYTORCH
conda clean -ya && \
rm environment.yml
ENV PATH /root/miniconda3/envs/${CONDA_ENV}/bin:$PATH
ENV LD_LIBRARY_PATH="/root/miniconda3/envs/${CONDA_ENV}/lib:$LD_LIBRARY_PATH"
# if you want this environment to be the default one, uncomment the following line:
ENV CONDA_DEFAULT_ENV=${CONDA_ENV}
ENV \
PATH /root/miniconda3/envs/${CONDA_ENV}/bin:$PATH \
LD_LIBRARY_PATH="/root/miniconda3/envs/${CONDA_ENV}/lib:$LD_LIBRARY_PATH" \
# if you want this environment to be the default one, uncomment the following line:
CONDA_DEFAULT_ENV=${CONDA_ENV}
COPY ./requirements/extra.txt requirements-extra.txt
COPY ./requirements/test.txt requirements-test.txt

View File

@ -31,11 +31,11 @@ ARG CMAKE_VERSION=3.18.4
SHELL ["/bin/bash", "-c"]
# https://techoverflow.net/2019/05/18/how-to-fix-configuring-tzdata-interactive-input-when-building-docker-images/
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Prague
ENV PATH="$PATH:/root/.local/bin"
ENV CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda"
ENV \
DEBIAN_FRONTEND=noninteractive \
TZ=Europe/Prague \
PATH="$PATH:/root/.local/bin" \
CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda"
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
@ -67,15 +67,16 @@ RUN apt-get update -qq && \
rm -rf /root/.cache && \
rm -rf /var/lib/apt/lists/*
ENV HOROVOD_GPU_OPERATIONS=NCCL
ENV HOROVOD_WITH_PYTORCH=1
ENV HOROVOD_WITHOUT_TENSORFLOW=1
ENV HOROVOD_WITHOUT_MXNET=1
ENV HOROVOD_WITH_GLOO=1
ENV HOROVOD_WITHOUT_MPI=1
#ENV MAKEFLAGS="-j$(nproc)"
ENV MAKEFLAGS="-j1"
ENV TORCH_CUDA_ARCH_LIST="3.7;5.0;6.0;7.0;7.5"
ENV \
HOROVOD_GPU_OPERATIONS=NCCL \
HOROVOD_WITH_PYTORCH=1 \
HOROVOD_WITHOUT_TENSORFLOW=1 \
HOROVOD_WITHOUT_MXNET=1 \
HOROVOD_WITH_GLOO=1 \
HOROVOD_WITHOUT_MPI=1 \
# MAKEFLAGS="-j$(nproc)" \
MAKEFLAGS="-j1" \
TORCH_CUDA_ARCH_LIST="3.7;5.0;6.0;7.0;7.5"
COPY ./requirements.txt requirements.txt
COPY ./requirements/ ./requirements/

View File

@ -25,8 +25,9 @@ SHELL ["/bin/bash", "-c"]
ARG CONDA_VERSION=4.7.12
# for skipping configurations
ENV DEBIAN_FRONTEND=noninteractive
ENV CONDA_ENV=lightning
ENV \
DEBIAN_FRONTEND=noninteractive \
CONDA_ENV=lightning
# show system inforation
RUN lsb_release -a && cat /etc/*-release
@ -53,8 +54,9 @@ RUN apt-get update -qq && \
rm -rf /root/.cache && \
rm -rf /var/lib/apt/lists/*
ENV PATH="/root/miniconda3/bin:$PATH"
ENV LD_LIBRARY_PATH="/root/miniconda3/lib:$LD_LIBRARY_PATH"
ENV \
PATH="/root/miniconda3/bin:$PATH" \
LD_LIBRARY_PATH="/root/miniconda3/lib:$LD_LIBRARY_PATH"
COPY environment.yml environment.yml
RUN conda create -y --name $CONDA_ENV && \
@ -67,10 +69,11 @@ RUN conda create -y --name $CONDA_ENV && \
conda clean -ya && \
rm environment.yml
ENV PATH /root/miniconda3/envs/${CONDA_ENV}/bin:$PATH
ENV LD_LIBRARY_PATH="/root/miniconda3/envs/${CONDA_ENV}/lib:$LD_LIBRARY_PATH"
# if you want this environment to be the default one, uncomment the following line:
ENV CONDA_DEFAULT_ENV=${CONDA_ENV}
ENV \
PATH=/root/miniconda3/envs/${CONDA_ENV}/bin:$PATH \
LD_LIBRARY_PATH="/root/miniconda3/envs/${CONDA_ENV}/lib:$LD_LIBRARY_PATH" \
# if you want this environment to be the default one, uncomment the following line:
CONDA_DEFAULT_ENV=${CONDA_ENV}
# Disable cache
RUN pip --version && \