Create Dockerfile (#1569)

* Create Dockerfile

* add readme

* Update MANIFEST.in

* Update Dockerfile

Co-authored-by: J. Borovec <jirka.borovec@seznam.cz>
This commit is contained in:
Justus Schock
2020-04-25 14:17:09 -04:00
committed by GitHub
co-authored by J. Borovec
parent e684fdf60b
commit d1279afff8
3 changed files with 57 additions and 0 deletions
+2
View File
@@ -42,3 +42,5 @@ prune notebook*
prune temp*
prune test*
prune benchmark*
prune docker
+42
View File
@@ -0,0 +1,42 @@
ARG CUDA_VERSION=10.1
FROM nvidia/cuda:${CUDA_VERSION}-base
# install versions
ARG PYTHON_VERSION=3.7
ARG PYTORCH_VERSION=1.4
ARG LIGHTNING_VERSION=master
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
curl \
ca-certificates
# add non-root user
RUN useradd --create-home --shell /bin/bash containeruser
USER containeruser
WORKDIR /home/containeruser
# install conda and python
RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /home/containeruser/conda && \
rm ~/miniconda.sh && \
/home/containeruser/conda/bin/conda clean -ya && \
/home/containeruser/conda/bin/conda install -y python=$PYTHON_VERSION
# add conda to path
ENV PATH /home/containeruser/conda/bin:$PATH
# install dependencies
RUN pip install torch==$PYTORCH_VERSION
RUN git clone https://github.com/PyTorchLightning/pytorch-lightning.git --single-branch --branch $LIGHTNING_VERSION && \
pip install ./pytorch-lightning && \
pip install -r pytorch-lightning/requirements-extra.txt && \
rm -rf pytorch-lightning
RUN python -c "import pytorch_lightning as pl; print(pl.__version__)"
CMD ["/bin/bash"]
+13
View File
@@ -0,0 +1,13 @@
## Builds
You can build it on your own, note it takes lots of time, be prepared.
```bash
git clone <git-repository>
docker image build -t pytorch-lightning:py36 -f docker/Dockerfile --build-arg PYTHON_VERSION=3.6 .
```
To build other versions, select different Dockerfile.
```bash
docker image list
docker run --rm -it pytorch-lightning:py36 bash
docker image rm pytorch-lightning:py36
```