-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathDockerfile.debian
More file actions
80 lines (63 loc) · 2.76 KB
/
Dockerfile.debian
File metadata and controls
80 lines (63 loc) · 2.76 KB
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
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG TAG
ARG REQUIREMENTS_PYTHON_BASE
ARG REQUIREMENTS_PYTHON_SPECIFIC
# setup environment
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /dltk/.local/bin:/dltk/.local/lib/python3.9/site-packages/:$PATH
ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC
# curl not installed in some images :(
RUN apt-get update
RUN apt-get install curl -y
# install nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
RUN apt-get update --fix-missing && apt-get install -y wget bzip2 git ca-certificates nodejs build-essential
# update everything
RUN apt-get update && apt-get upgrade -y
# configure file system
WORKDIR /srv
RUN mkdir /dltk
# setup python+pip
RUN apt-get install -y python3 python3-pip
# install base python requirements
COPY ./requirements_files/${REQUIREMENTS_PYTHON_BASE} /dltk/${REQUIREMENTS_PYTHON_BASE}
RUN pip3 install --no-cache-dir --upgrade -r /dltk/${REQUIREMENTS_PYTHON_BASE}
# install specific python requirements
COPY ./requirements_files/${REQUIREMENTS_PYTHON_SPECIFIC} /dltk/${REQUIREMENTS_PYTHON_SPECIFIC}
RUN pip3 install --no-cache-dir --upgrade -r /dltk/${REQUIREMENTS_PYTHON_SPECIFIC}
# configure spacy if it was installed
RUN if pip3 freeze | grep -q spacy;\
then echo 'Spacy is installed, downloading language file...';\
python3 -m spacy download en_core_web_sm;\
else echo 'Spacy is not installed'; fi
# creating new self signed certs and/or copy custom certs
RUN openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout dltk.key -out dltk.pem -subj="/CN=dsdl"
COPY certificates .
RUN mkdir /dltk/.jupyter/; mv dltk.key /dltk/.jupyter/dltk.key; mv dltk.pem /dltk/.jupyter/dltk.pem; rm README.md
# Copy bootstrap entry point script
COPY ./bootstrap_scripts/bootstrap_fast.sh /dltk/
COPY app /dltk/app
COPY notebooks /dltk/notebooks
# Install local DSDL supporting functions
RUN mkdir /dltk/packages
COPY package-dsdlsupport/dist/dsdlsupport-1.0.0.tar.gz /dltk/packages/dsdlsupport-1.0.0.tar.gz
RUN pip3 install /dltk/packages/dsdlsupport-1.0.0.tar.gz
# Copy jupyter config
COPY config/jupyter_notebook_config.py /dltk/.jupyter/jupyter_notebook_config.py
# Since JupyterLab 3 jupyter server config needs to be set
COPY config/jupyter_server_config.py /dltk/.jupyter/jupyter_server_config.py
# Copy jupyter notebook conversion template to export python module
COPY config/jupyter_notebook_template.tpl /dltk/.jupyter/jupyter_notebook_conversion.tpl
COPY config/null.tpl /dltk/.jupyter/null.tpl
# Handle user rights
RUN chgrp -R 0 /dltk && \
chmod -R g=u /dltk
RUN chgrp -R 0 /srv && \
chmod -R g=u /srv
RUN chmod g+w /etc/passwd
USER 1001
# Expose container port 5000 (MLTK Container Service) and 8888 (Notebook)
EXPOSE 5000 8888
# Define bootstrap as entry point to start container
ENTRYPOINT ["/dltk/bootstrap_fast.sh"]