forked from hereariim/DEEP-OC-blossom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
152 lines (119 loc) · 5.04 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Dockerfile may have following Arguments:
# tag - tag for the Base image, (e.g. 1.14.0-py3 for tensorflow)
# branch - user repository branch to clone (default: master, another option: test)
# jlab - if to insall JupyterLab (true) or not (false)
# oneclient_ver - version of oneclient to install (e.g. 19.02.0.rc2-1~bionic)
#
# To build the image:
# $ docker build -t <dockerhub_user>/<dockerhub_repo> --build-arg arg=value .
# or using default args:
# $ docker build -t <dockerhub_user>/<dockerhub_repo> .
#
# Be Aware! For the Jenkins CI/CD pipeline,
# input args are defined inside the Jenkinsfile, not here!
#
ARG tag=1.14.0-py3
# Base image, e.g. tensorflow/tensorflow:1.14.0-py3
FROM tensorflow/tensorflow:${tag}
LABEL maintainer='Herearii Metuarea'
LABEL version='0.0.1'
# We suggest a 2D image segmentation model based on UNET algorithm to segment images with blossoming apple tree
# What user branch to clone [!]
ARG branch=master
# If to install JupyterLab
ARG jlab=true
# Oneclient version, has to match OneData Provider and Linux version
ARG oneclient_ver=19.02.0.rc2-1~bionic
# Fix NVIDIA public key is not available (TF 1.14)
RUN DEBIAN_FRONTEND=noninteractive apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
# Install ubuntu updates and python related stuff
# link python3 to python, pip3 to pip, if needed
# Remember: DEEP API V2 only works with python 3.6 [!]
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y --no-install-recommends \
git \
curl \
wget \
python3-setuptools \
python3-pip \
python3-wheel && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/* && \
if [ ! -e /usr/bin/pip ]; then \
ln -s /usr/bin/pip3 /usr/bin/pip; \
fi; \
if [ ! -e /usr/bin/python ]; then \
ln -s /usr/bin/python3 /usr/bin/python; \
fi && \
python --version && \
pip --version
# Set LANG environment
ENV LANG C.UTF-8
# Set the working directory
WORKDIR /srv
# Install rclone
RUN wget https://downloads.rclone.org/rclone-current-linux-amd64.deb && \
dpkg -i rclone-current-linux-amd64.deb && \
apt install -f && \
mkdir /srv/.rclone/ && touch /srv/.rclone/rclone.conf && \
rm rclone-current-linux-amd64.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/*
ENV RCLONE_CONFIG=/srv/.rclone/rclone.conf
# INSTALL oneclient for ONEDATA
RUN curl -sS http://get.onedata.org/oneclient-1902.sh | bash -s -- oneclient="$oneclient_ver" && \
apt-get clean && \
mkdir -p /mnt/onedata && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*
RUN pip install --upgrade pip
RUN pip install --upgrade deepaas
# Install DEEPaaS from PyPi
# Install FLAAT (FLAsk support for handling Access Tokens)
RUN pip install --no-cache-dir \
'deepaas>=1.3.0' \
flaat && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/*
# Disable FLAAT authentication by default
ENV DISABLE_AUTHENTICATION_AND_ASSUME_AUTHENTICATED_USER yes
# EXPERIMENTAL: install deep-start script
# N.B.: This repository also contains run_jupyter.sh
RUN git clone https://github.com/deephdc/deep-start /srv/.deep-start && \
ln -s /srv/.deep-start/deep-start.sh /usr/local/bin/deep-start && \
ln -s /srv/.deep-start/run_jupyter.sh /usr/local/bin/run_jupyter
# Install JupyterLab
ENV JUPYTER_CONFIG_DIR /srv/.deep-start/
# Necessary for the Jupyter Lab terminal
ENV SHELL /bin/bash
RUN if [ "$jlab" = true ]; then \
# by default has to work (1.2.0 wrongly required nodejs and npm)
pip install --no-cache-dir jupyterlab ; \
else echo "[INFO] Skip JupyterLab installation!"; fi
# Install user app:
RUN git clone -b $branch https://github.com/hereariim/blossom && \
cd blossom && \
pip install --no-cache-dir -e . && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/* && \
cd ..
# Open DEEPaaS port
EXPOSE 5000
# Open Monitoring and Jupyter ports
EXPOSE 6006 8888
# Account for OpenWisk functionality (deepaas >=0.4.0) + proper docker stop
CMD ["deepaas-run", "--openwhisk-detect", "--listen-ip", "0.0.0.0", "--listen-port", "5000"]
# CMD ["deepaas-run", "--openwhisk-detect", "--listen-ip", "127.0.0.1", "--listen-port", "5000"]
# After pushing files in github repository =>
# 1- docker build --no-cache -t deephdc/uc-hereariim-deep-oc-blossom .
# 2- docker run -ti -p 5000:5000 -p 6006:6006 -p 8888:8888 deephdc/uc-hereariim-deep-oc-blossom
# 1- docker build --no-cache -t deephdc/uc-hereariim-deep-oc-blossom .
# 2- docker run -ti -p 5000:5000 -p 6006:6006 -p 8888:8888 deephdc/uc-hereariim-deep-oc-blossom
# docker run -ti -p 5000:5000 -p 6006:6006 -p 8888:8888 deephdc/uc-hereariim-deep-oc-blossom /bin/bash
# deepaas-run --listen-ip 0.0.0.0
# docker run -ti -v C:/Users/User/AppData/Roaming/rclone/rclone.conf:/rclone/rclone.conf deephdc/uc-hereariim-deep-oc-blossom /bin/bash
# docker run -ti -v C:/Users/User/AppData/Roaming/rclone/rclone.conf:/srv/.rclone/rclone.conf -p 5000:5000 deephdc/uc-hereariim-deep-oc-blossom