forked from sansurrogate/basic_python_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (31 loc) · 1.24 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
FROM python:3.9-slim-buster AS builder
# convert pyproject.yaml to requirements.txt
WORKDIR /build
RUN pip install --upgrade pip
RUN pip install poetry
COPY pyproject.toml poetry.lock ./
RUN poetry export --dev --without-hashes -f requirements.txt --output requirements.txt
############################################
FROM python:3.9-slim-buster
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /build
# install nodejs
RUN apt update && apt install -y curl
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt update && apt install -y nodejs
# install necessary packages
COPY --from=builder /build/requirements.txt .
RUN pip install -r ./requirements.txt
# jupyterlab extension for plotly
RUN jupyter labextension install jupyterlab-plotly @jupyter-widgets/jupyterlab-manager plotlywidget
# set user privileges
RUN useradd user
RUN chown -R user /build
RUN mkdir -p /home/user/project && chown -R user /home
USER user
WORKDIR /home/user/project
ENV HOME /home/user
EXPOSE 8888
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--notebook-dir=/home/user/project"]