forked from karpov-sv/stdpipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (55 loc) · 2.08 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
# Building image from
FROM ubuntu:20.04
LABEL maintainer="Sergey Karpov <[email protected]>"
# Create a variable corresponding to the name of the new user that will be created inside the Docker.
ENV USERNAME newuser
# Create new user
RUN useradd -ms /bin/bash ${USERNAME}
# Set the working directory
WORKDIR /home
# Fix for tzdata which is pulled by some dependencies
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Prague
# Install updates to base image, install packages, and remove from cache
# Install hotpants
# Install Jupyter
# Install some Python packages
# All done in one line to limit docker size
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends build-essential ca-certificates libtool libcfitsio-dev autoconf automake git unzip python3-pip \
sextractor scamp psfex swarp \
jupyter jupyter-notebook jupyter-nbextension-jupyter-js-widgets python3-ipywidgets \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/acbecker/hotpants.git \
&& cd hotpants \
&& make \
&& cp hotpants /usr/local/bin/ \
&& cd .. \
&& rm -fr hotpants \
&& python3 -m pip install --upgrade pip \
&& python3 -m pip install setuptools
# Install STDPipe
RUN \
git clone https://github.com/karpov-sv/stdpipe.git \
&& cd stdpipe \
&& python3 -m pip install -e . \
&& rm -fr /home/newuser/.cache/pip \
&& rm -fr /root/.cache/pip \
&& rm -fr /root/.cache/* \
&& rm -fr /tmp/* \
&& apt-get autoremove --purge -y
# switch ownership
# (all commands are root until a USER command changes that)
USER ${USERNAME}
# change ownership from root to USR:
# Create `stdpipe` directory to link on volume with host machine
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME} \
&& mkdir /home/${USERNAME}/stdpipe/
# Add local bin to PATH
ENV PATH="/home/${USERNAME}/.local/bin:$PATH"
# Change working directory to stdpipe
WORKDIR /home/${USERNAME}/stdpipe
# define entrypoint which is the default executable at launch
ENTRYPOINT ["jupyter", "notebook", "--no-browser", "--ip=0.0.0.0", "--NotebookApp.token=''"]
EXPOSE 8888