generated from mysociety/python-data-auto-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 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
FROM ghcr.io/mysociety/data_common:sha-3e041ca
# 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/
ENV WORKSPACE_NAME voting_data
RUN mkdir /setup/src/$WORKSPACE_NAME \
&& touch /setup/src/$WORKSPACE_NAME/__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/$WORKSPACE_NAME/src/" > /usr/local/lib/python3.10/site-packages/$WORKSPACE_NAME.pth \
&& echo "/workspaces/$WORKSPACE_NAME/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}