-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
50 lines (49 loc) · 1.7 KB
/
docker-compose.yml
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
version: "3"
services:
jupyter:
image: jupyter/minimal-notebook
hostname: jupyter
container_name: jupyter
restart: unless-stopped
environment:
- CHOWN_EXTRA=/home/${NOTEBOOK_USER}/work
- CHOWN_EXTRA_OPTS=-R
- NB_UID=1000
- NB_GID=100
- NB_USER=${NOTEBOOK_USER}
- NB_GROUP=users
- JUPYTER_ENABLE_LAB=yes
- CHOWN_HOME=yes
- CHOWN_HOME_OPTS=-R
- JUPYTER_TOKEN=${JUPYTER_TOKEN}
- PASSWORD_HASH=${PASSWORD_HASH}
- NVIDIA_VISIBLE_DEVICES=all
runtime: nvidia
ports:
- "8888:8888"
volumes:
- ${PWD}/work:/home/${NOTEBOOK_USER}/work
- ${PWD}/work/environments:/home/${NOTEBOOK_USER}/work/environments
working_dir: /home/${NOTEBOOK_USER}/work
command:
/bin/bash -c "if ls /home/${NOTEBOOK_USER}/work/environments/*.yml >/dev/null 2>&1; then \
for f in /home/${NOTEBOOK_USER}/work/environments/*.yml; do \
env_name=$$(basename $${f%.yml}); \
if conda env list | grep -q $${env_name}; then \
echo \"Environment $${env_name} already exists. Skipping...\"; \
else \
echo \"Creating environment $${env_name}...\"; \
conda env create --quiet --name $${env_name} --file $${f}; \
fi; \
done; \
else \
echo \"No environment files found. Creating default environment...\"; \
conda install --quiet --yes numpy; \
fi && \
conda clean --all -f -y && \
fix-permissions \"/opt/conda\" && \
fix-permissions \"/home/${NOTEBOOK_USER}\" && \
start-notebook.sh --NotebookApp.token='${JUPYTER_TOKEN}' --NotebookApp.allow_password_change=True --NotebookApp.password='${PASSWORD_HASH}'"
user: root
env_file:
- .env