This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
forked from lifewatch/DEEP-OC-phyto-plankton-classification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
155 lines (122 loc) · 4.97 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
153
154
155
# Dockerfile may have two Arguments: tag, branch
# tag - tag for the Base image, (e.g. 1.10.0-py3 for tensorflow)
# branch - user repository branch to clone (default: master, other option: test)
ARG tag=1.14.0-py3
# Base image, e.g. tensorflow/tensorflow:1.12.0-py3
FROM tensorflow/tensorflow:${tag}
# Add container's metadata to appear along the models metadata
ENV CONTAINER_MAINTAINER "Wout Decrop <wout.decrop@vliz.be>"
ENV CONTAINER_VERSION "0.1"
ENV CONTAINER_DESCRIPTION "DEEP as a Service Container: phyto-plankton Classification"
# What user branch to clone (!)
ARG branch=master
# Install ubuntu updates and python related stuff
# link python3 to python, pip3 to pip, if needed
ENV DEBIAN_FRONTEND=noninteractive
# Attempt to remove the file, and continue even if it fails (|| true)
RUN rm /etc/apt/sources.list.d/cuda.list || true
RUN rm /etc/apt/sources.list.d/nvidia-ml.list || true
# Install required packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
curl \
wget \
psmisc \
python3-setuptools \
python3-pip \
python3-wheel \
libgl1 \
libsm6 \
libxrender1 \
libfontconfig1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache/pip/* \
&& rm -rf /tmp/*e/pip/* \
&& rm -rf /tmp/*
# Install OpenCV-Python (replace version with the one you want)
RUN pip3 install --upgrade pip setuptools wheel \
&& pip3 install opencv-python==3.4.17.61
# # Needed for open-cv
# RUN apt-get update && \
# apt-get install -y libgl1 libsm6 libxrender1 libfontconfig1 && \
# apt-get install -y python3-opencv
# 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/*
# Install deep-start script
# * allows to run shorter command "deep-start"
# * allows to install jupyterlab or code-server (vscode),
# if requested during container creation
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
# Install FLAAT (FLAsk support for handling Access Tokens)
RUN pip install --no-cache-dir flaat && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/*
# # Install FLAAT (FLAsk support for handling Access Tokens)
# RUN pip install --no-cache-dir flaat && \
# rm -rf /root/.cache/pip/* && \
# rm -rf /tmp/*
# Disable FLAAT authentication by default
ENV DISABLE_AUTHENTICATION_AND_ASSUME_AUTHENTICATED_USER yes
# Install DEEPaaS from PyPi:
RUN pip install --no-cache-dir deepaas && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/*
# Useful tool to debug extensions loading
RUN pip install --no-cache-dir entry_point_inspector && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/*
# Necessary for the Jupyter Lab terminal, if requested
ENV SHELL /bin/bash
# Install user app:
RUN git clone -b $branch --depth 1 https://github.com/lifewatch/phyto-plankton-classification && \
cd phyto-plankton-classification && \
pip3 install --no-cache-dir -e . && \
rm -rf /root/.cache/pip/* && \
rm -rf /tmp/* && \
cd ..
# Download network weights
# ENV SWIFT_CONTAINER https://api.cloud.ifca.es:8080/swift/v1/phytoplankton-tf/
# ENV MODEL_TAR phytoplankton.tar.xz
# RUN curl --insecure -o ./phyto-plankton-classification/models/${MODEL_TAR} \
# ${SWIFT_CONTAINER}${MODEL_TAR}
# RUN cd phyto-plankton-classification/models && \
# tar -xf ${MODEL_TAR} &&\
# rm ${MODEL_TAR}
# https://share.services.ai4os.eu/index.php/s/rJQPQtBReqHAPf3/download/phytoplankton_vliz.tar.gz
# https://share.services.ai4os.eu/index.php/s/dFg9cma5FwG6PZD/download/phytoplankton_vliz.tar.xz
# ENV SWIFT_CONTAINER https://share.services.ai4os.eu/index.php/s/jfS26BjQzHx3osc/download/
ENV SWIFT_CONTAINER=https://share.services.ai4os.eu/index.php/s/rJQPQtBReqHAPf3/download
ENV MODEL_TAR=phytoplankton_vliz.tar.gz
# mkdir -p ./phyto-plankton-classification/models \
# Download and extract the file
RUN curl -L ${SWIFT_CONTAINER} -o ./phyto-plankton-classification/models/${MODEL_TAR}
RUN cd ./phyto-plankton-classification/models && \
tar -xzf ${MODEL_TAR} && \
rm ${MODEL_TAR}
# RUN mkdir -p ./phyto-plankton-classification/models/phytoplankton/ckpts && \
# curl --insecure -o ./phyto-plankton-classification/models/phytoplankton/ckpts/${MODEL_TAR} \
# ${SWIFT_CONTAINER}
# Open DEEPaaS port
EXPOSE 5000
# Open Monitoring port
EXPOSE 6006
# Open JupyterLab port
EXPOSE 8888
# Account for OpenWisk functionality (deepaas >=0.4.0) + proper docker stop
# OpenWhisk support is deprecated
CMD ["deepaas-run", "--listen-ip", "0.0.0.0", "--listen-port", "5000"]