1 # Copyright (c) 2019 Intel Corporation
2 # Licensed to the Apache Software Foundation (ASF) under one or more
3 # contributor license agreements. See the NOTICE file distributed with
4 # this work for additional information regarding copyright ownership.
5 # The ASF licenses this file to You under the Apache License, Version 2.0
6 # (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
23 # Install all the essentials
24 RUN apt-get update --fix-missing && \
25 apt-get install -y --no-install-recommends wget curl ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 \
26 git build-essential openssh-server openssh-client && \
27 mkdir -p /var/run/sshd && \
29 rm -rf /var/lib/apt/lists/*
31 ENV PATH /opt/conda/bin:$PATH
34 RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
35 /bin/bash ~/miniconda.sh -b -p /opt/conda && \
36 rm ~/miniconda.sh && \
37 ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
38 echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
39 echo "conda activate base" >> ~/.bashrc
41 # Install python libraries using conda in the virtual_environment:ml_env
42 SHELL ["/bin/bash", "-c"]
43 RUN conda update -n base -c defaults conda && \
44 conda create -n ml_env
45 RUN conda install -n ml_env -y -c anaconda pip
47 RUN conda install -n ml_env -y -c anaconda h5py
49 RUN conda install -n ml_env -y -c pytorch pytorch-cpu
50 RUN conda install -n ml_env -y -c conda-forge nlopt
52 RUN echo "conda activate ml_env" >> ~/.bashrc
54 RUN /opt/conda/envs/ml_env/bin/pip install --no-cache-dir minio
57 RUN apt-get install -y --no-install-recommends curl grep sed dpkg && \
58 TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && echo ${TINI_VERSION} && \
59 curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \
64 # This is needed to match the original entrypoint.sh file.
65 RUN cp /usr/bin/tini /sbin
68 RUN echo "export PATH=/opt/conda/envs/ml_env/bin:$PATH" >> ~/.bashrc
73 RUN conda install -n ml_env -y --file requirements.txt
75 ENTRYPOINT [ "/app/entrypoint.sh" ]