Sample application to load model from Minio
[demo.git] / vnfs / DAaaS / sample-apps / sample-minio-load-model / build / Dockerfile
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
8 #
9 #    http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16 #
17
18
19 FROM ubuntu:18.04
20
21 RUN apt update -yqq 
22
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 && \
28     apt-get clean && \
29     rm -rf /var/lib/apt/lists/*
30
31 ENV PATH /opt/conda/bin:$PATH
32
33 # Install miniconda
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
40
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 
46 RUN pwd
47 RUN conda install -n ml_env -y -c anaconda h5py
48
49 RUN conda install -n ml_env -y -c pytorch pytorch-cpu
50 RUN conda install -n ml_env -y -c conda-forge nlopt
51
52 RUN echo "conda activate ml_env" >> ~/.bashrc
53 RUN source ~/.bashrc
54 RUN /opt/conda/envs/ml_env/bin/pip install --no-cache-dir minio
55
56 # Install tini
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 && \
60     dpkg -i tini.deb && \
61     rm tini.deb && \
62     apt clean
63
64 # This is needed to match the original entrypoint.sh file.
65 RUN cp /usr/bin/tini /sbin
66
67
68 RUN echo "export PATH=/opt/conda/envs/ml_env/bin:$PATH" >> ~/.bashrc
69
70 COPY . /app
71 WORKDIR /app
72 RUN source ~/.bashrc
73 RUN conda install -n ml_env -y --file requirements.txt
74
75 ENTRYPOINT [ "/app/entrypoint.sh" ]