-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (56 loc) · 3.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM ubuntu:18.04
ARG python_version=3.9
ARG conda_cuda_version=11.1
ARG conda_cuda_shortcut=cu111
ARG pytorch_version=1.10.0
ARG torch_geometric_pytorch_version=1.10.0
MAINTAINER Elad Nachmias <eladnah@gmail.com>
ENV TERM xterm
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends git curl wget ca-certificates bzip2 unzip openjdk-8-jdk-headless gnupg software-properties-common
RUN DEBIAN_FRONTEND=noninteractive apt-get install lightdm -y
RUN curl -LO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
RUN mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
RUN apt-get update
RUN apt-get -y install cuda
RUN apt-get -y autoclean && apt-get -y autoremove
#RUN curl -o /root/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
# chmod +x /root/miniconda.sh && \
# /root/miniconda.sh -b && \
# rm /root/miniconda.sh && \
# /root/miniconda3/bin/conda clean -ya
#ENV PATH /root/miniconda3/bin:$PATH
RUN curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN chmod +x Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -p /miniconda -b
RUN rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda
RUN conda clean -ya
# https://hub.docker.com/r/rocker/cuda/dockerfile
WORKDIR /root/ndfa
RUN conda init bash
COPY requirements.unversioned.txt ./requirements.txt
COPY environment.unversioned.yml ./environment.yml
RUN sed -i "s/%PYTHON_VERSION%/${python_version}/g" environment.yml
RUN sed -i "s/%CUDA_VERSION%/${conda_cuda_version}/g" environment.yml
RUN sed -i "s/%CUDA_SHORTCUT%/${conda_cuda_shortcut}/g" environment.yml
RUN sed -i "s/%PYTORCH_VERSION%/${pytorch_version}/g" environment.yml
RUN sed -i "s/%TORCH_GEOMETRIC_PYTORCH_VERSION%/${torch_geometric_pytorch_version}/g" environment.yml
RUN sed -i "s/%PYTHON_VERSION%/${python_version}/g" requirements.txt
RUN sed -i "s/%CUDA_VERSION%/${conda_cuda_version}/g" requirements.txt
RUN sed -i "s/%CUDA_SHORTCUT%/${conda_cuda_shortcut}/g" requirements.txt
RUN sed -i "s/%PYTORCH_VERSION%/${pytorch_version}/g" requirements.txt
RUN sed -i "s/%TORCH_GEOMETRIC_PYTORCH_VERSION%/${torch_geometric_pytorch_version}/g" requirements.txt
RUN [ "${conda_cuda_shortcut}" = "cpu" ] && sed -i.bak '/cudatoolkit/d' environment.yml
RUN conda env create -f environment.yml
#RUN ["/bin/bash", "-c", "conda install --yes --file requirements.txt"]
#RUN ["/bin/bash", "-c", "pip install -r requirements.txt"]
#ENTRYPOINT ["conda", "run", "-n", "myenv", "python3", "src/server.py"]
# Pull the environment name out of the environment.yml
RUN echo "conda activate $(head -1 environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /miniconda/envs/$(head -1 environment.yml | cut -d' ' -f2)/bin:$PATH
CMD ["/bin/bash"]