generated from mysociety/python-data-auto-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (29 loc) · 1.26 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
# This dockerfile is used by binder.
FROM ghcr.io/mysociety/data_common:sha-54e0768
# Make an empty project directory so the 'self' setup doesn't fail and scripts can be setup
# Override the .pth created at previous stages to point to where the working directory will land
COPY pyproject.toml poetry.loc[k] /setup/
COPY src/data_common/pyproject.toml src/data_common/poetry.loc[k] /setup/src/data_common/
RUN mkdir /setup/src/publicwhip_data \
&& touch /setup/src/publicwhip_data/__init__.py \
&& mkdir --parents /setup/src/data_common/src/data_common \
&& touch /setup/src/data_common/src/data_common/__init__.py \
&& export PATH="/root/.local/bin:$PATH" \
&& cd /setup/ && poetry install \
&& echo "/workspaces/publicwhip_data/src/" > /usr/local/lib/python3.10/site-packages/publicwhip_data.pth \
&& echo "/workspaces/publicwhip_data/src/data_common/src" > /usr/local/lib/python3.10/site-packages/data_common.pth
# special binder instructions
RUN pip install --no-cache-dir notebook
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}