-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPy.dockerfile
52 lines (40 loc) · 1.24 KB
/
Py.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
# Python base image [pre-built debian-base python env]
FROM python:3
# reduce package overhead
ENV DEBIAN_FRONTEND=noninteractive \
TZ=UTC \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
# install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
python3 \
python3-dev \
python3-pip \
curl \
sudo \
git \
gfortran \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# user (for better security, don't run as root)
RUN useradd -m -s /bin/bash pymonk && \
echo "pymonk:password" | chpasswd && \
usermod -aG sudo pymonk
USER pymonk
# workspace
RUN mkdir -p ~/analysis && \
chown -R pymonk ~/analysis
WORKDIR ~/analysis
# (always specify exact version for python packages)
COPY requirements.txt ./
# python pkgs
#RUN python3 -m venv 0env && source 0env/bin/activate && \
RUN python3 -m pip install --upgrade pip setuptools wheel && python3 -m pip install --no-cache-dir -r requirements.txt
# For R integration, install `r-base` and pip install rpy2
# python shell
CMD ["python3"]
# (or, if you want to use jupyter notebook)
# jupyter notebook
#EXPOSE 8888
#CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]