-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
109 lines (89 loc) · 2.86 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
# Purpose: build a docker image for machine learning and data science tasks
# =========================================================================
# References:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/cpu-jupyter.Dockerfile
# https://github.com/faizanbashir/python-datascience/blob/master/Dockerfile
ARG UBUNTU_VERSION=18.04
FROM ubuntu:${UBUNTU_VERSION} as base
ARG USE_PYTHON_3_NOT_2=True
ARG _PY_SUFFIX=${USE_PYTHON_3_NOT_2:+3}
ARG PYTHON=python${_PY_SUFFIX}
ARG PIP=pip${_PY_SUFFIX}
# Adds metadata to the image as a key value pair example LABEL version="1.0"
LABEL maintainer="Jerry Yang <https://github.com/mathsrocks>"
# Set environment variables
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# Python data science and machine learning core packages
# * numpy: support for large, multi-dimensional arrays and matrices
# * matplotlib: plotting library for Python and its numerical mathematics extension NumPy.
# * scipy: library used for scientific computing and technical computing
# * scikit-learn: machine learning library integrates with NumPy and SciPy
# * pandas: library providing high-performance, easy-to-use data structures and data analysis tools
# * nltk: suite of libraries and programs for symbolic and statistical natural language processing for English
ENV PY_DSML_CORE_PKGS="\
numpy \
matplotlib \
scipy \
scikit-learn \
pandas \
seaborn \
Cython \
pathlib \
"
ENV PY_DSML_ADDON_PKGS="\
jupyter \
jupyterlab \
jupyter_contrib_nbextensions \
jupyter_nbextensions_configurator \
keras \
nltk \
pip-tools \
xgboost \
tensorflow \
torch torchvision \
"
# Pick up core dependencies
RUN apt-get update -y --fix-missing && \
apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
byobu \
bzip2 \
ca-certificates \
curl \
git-core \
htop \
libpq-dev \
pkg-config \
${PYTHON} \
${PYTHON}-dev \
${PYTHON}-pip \
${PYTHON}-setuptools \
unzip \
vim \
wget \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN ${PIP} --no-cache-dir install --upgrade \
pip \
setuptools
# Install Python core packages
RUN ${PIP} install -U --no-cache-dir ${PY_DSML_CORE_PKGS}
# Install Python add-on packages
RUN ${PIP} install -U --no-cache-dir ${PY_DSML_ADDON_PKGS}
# Install Python packages according to requirements.txt
COPY requirements.txt /requirements.txt
RUN ${PIP} install --no-cache-dir -Ur /requirements.txt
RUN jupyter contrib nbextension install --user
RUN jupyter nbextensions_configurator enable --user
ENV WORKSPACE="jupyter"
RUN mkdir ${WORKSPACE}
COPY conf/.jupyter /root/.jupyter
COPY run_jupyter.sh /
# Open Ports for Jupyter and Tensorboard
EXPOSE 8888 6006
VOLUME /${WORKSPACE}
WORKDIR /${WORKSPACE}
# Run the shell
CMD ["/run_jupyter.sh"]