-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
70 lines (56 loc) · 1.95 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
FROM gispo/minimal-notebook AS common
LABEL maintainer="gispo<[email protected]>"
USER root
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
# For psql
'postgresql-client=12+214ubuntu0.1' \
gdal-bin \
# For gdal python bindings
libgdal-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Add js files required for interactive Kepler
RUN jupyter nbextension install --py --sys-prefix keplergl \
&& jupyter nbextension enable --py --sys-prefix keplergl
# Build just the notebook part
FROM common AS geoviz-notebook
WORKDIR "${HOME}"
USER jovyan
ENV LOGIN_HEADER='Geoviz notebooks' \
LOGIN_CONTENT='Tämä notebook on suojattu salasanalla.'
# Reset login page
RUN sed -i "s/Otsikko/$LOGIN_HEADER/g" /opt/conda/lib/python3.8/site-packages/notebook/templates/login.html \
&& sed -i "s/sisältö/$LOGIN_CONTENT/g" /opt/conda/lib/python3.8/site-packages/notebook/templates/login.html
USER root
COPY notebooks/start-notebook.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/start-notebook.sh \
&& mkdir /usr/local/tmp_tbls \
&& chown -R jovyan /usr/local/tmp_tbls \
&& chmod 700 /usr/local/tmp_tbls
USER jovyan
ENV NB_USER=analyst \
CHOWN_HOME=yes \
RESTARTABLE=yes \
JUPYTER_TOKEN=postgres \
PGUSER=postgres \
PGPASSWORD=postgres \
PGDATABASE=geoviz \
PGHOST=localhost
# Build just the server part
FROM common AS geoviz-server
COPY server/requirements-serve.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements-serve.txt
# For flask server, looks like 'pip install uwsgi' fails for some reason
# and 'conda install uwsgi' hangs forever
RUN apt-get update && apt-get install -y --no-install-recommends uwsgi uwsgi-plugin-python3
COPY . /app
WORKDIR /app
# Override container startup
ENTRYPOINT ["/bin/sh", "-c"]
#CMD ["ls", "-la"]
CMD ["/app/server/start.sh"]