forked from jataware/beaker-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (32 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
41 lines (32 loc) · 1.39 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
FROM python:3.10
RUN useradd -m jupyter
RUN useradd -m user
EXPOSE 8888
RUN apt update && apt install -y lsof
# Install Python requirements
RUN pip install --upgrade --no-cache-dir hatch pip
# Install project requirements
# Hack to install requirements without requiring the rest of the files
COPY --chown=1000:1000 pyproject.toml /jupyter/
RUN bash -c "pip install --no-build-isolation --no-cache-dir -r <(\
echo 'import tomli; \
c = tomli.load(open(\"/jupyter/pyproject.toml\", \"rb\")); \
d = c[\"project\"][\"dependencies\"]; \
print(\"\n\".join(f\"{dep}\" for dep in d))' | python \
)"
# Copy src code over
COPY --chown=1000:1000 . /jupyter
RUN chown -R 1000:1000 /jupyter
RUN pip install --no-build-isolation --no-cache-dir /jupyter
RUN mkdir -m 755 /var/run/beaker
RUN mkdir -m 777 /var/run/beaker/checkpoints
# Set default server env variables
ENV BEAKER_AGENT_USER=jupyter
ENV BEAKER_SUBKERNEL_USER=user
ENV BEAKER_RUN_PATH=/var/run/beaker
VOLUME /var/run/beaker /jupyter /jupyter/beaker_kernel/service/ui /usr/local/share/jupyter/kernels/beaker_kernel
# Beaker Server should run as root, but local notebooks should not as Beaker Server sets the UID of running kernels to
# an unprivileged user account when kernel processes are spawned
USER root
# Simple "notebook" service
CMD ["python3.10", "-m", "beaker_kernel.service.server", "--ip", "0.0.0.0"]