Skip to content

Commit e6fb449

Browse files
committed
[Tutorial] Add tutorail env setting scripts
1 parent c39c3a3 commit e6fb449

6 files changed

Lines changed: 71 additions & 4 deletions

File tree

.github/workflows/docker-tutorial-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
uses: docker/build-push-action@v4
3131
with:
3232
context: .
33-
file: ./Dockerfile.ksc2025
33+
file: ./tutorial/jupyterhub/Dockerfile.ksc2025
3434
push: true
3535
tags: ghcr.io/psal-postech/torchsim_ksc2025:latest

tutorial/jupyterhub/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM jupyterhub/jupyterhub:latest
2+
3+
RUN pip install --no-cache-dir \
4+
dockerspawner \
5+
jupyterhub-nativeauthenticator
6+
7+
WORKDIR /srv/jupyterhub
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ ENV PATH=$PATH:/root/.local/bin
4040
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/conda/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
4141

4242
# Build Gem5
43-
RUN git clone https://github.com/PSAL-POSTECH/gem5.git --branch TorchSim
44-
RUN cd gem5 && scons build/RISCV/gem5.opt -j $(nproc)
43+
RUN git clone https://github.com/PSAL-POSTECH/gem5.git --branch tutorial
44+
RUN cd gem5 && scons build/RISCV/gem5.opt -j $(nproc) && git checkout TorchSim
4545
ENV GEM5_PATH=/workspace/gem5/build/RISCV/gem5.opt
4646

4747
# Build LLVM RISC-V
@@ -87,4 +87,6 @@ RUN cd PyTorchSim/TOGSim && \
8787
cd build && \
8888
conan install .. --build=missing && \
8989
cmake .. && \
90-
make -j$(nproc)
90+
make -j$(nproc)
91+
92+
RUN pip install jupyterhub jupyterlab
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: '3'
2+
3+
services:
4+
jupyterhub:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: jupyterhub
9+
image: my-jupyterhub-image
10+
volumes:
11+
- /var/run/docker.sock:/var/run/docker.sock
12+
- ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
13+
environment:
14+
# DockerSpawner가 사용할 네트워크 이름
15+
DOCKER_NETWORK_NAME: jupyterhub-network
16+
# Hub가 내부적으로 사용할 IP
17+
HUB_IP: jupyterhub
18+
ports:
19+
- "8000:8000"
20+
networks:
21+
- jupyterhub-network
22+
23+
networks:
24+
jupyterhub-network:
25+
external: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
3+
c = get_config()
4+
5+
# ------------------------------------------------------------------------------
6+
# Spawner config
7+
# ------------------------------------------------------------------------------
8+
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
9+
c.DockerSpawner.image = "torchsim-ksc2025:latest"
10+
11+
# Resource limit
12+
c.DockerSpawner.mem_limit = '16G'
13+
c.DockerSpawner.cpu_limit = 4.0
14+
15+
c.DockerSpawner.network_name = 'jupyterhub-network'
16+
c.Spawner.default_url = '/lab'
17+
c.Spawner.ip = '0.0.0.0'
18+
c.DockerSpawner.remove = False
19+
c.DockerSpawner.cmd = ["jupyterhub-singleuser", "--allow-root"]
20+
21+
c.JupyterHub.authenticator_class = 'nativeauthenticator.NativeAuthenticator'
22+
c.Authenticator.admin_users = {'admin'}
23+
24+
c.JupyterHub.hub_ip = 'jupyterhub'
25+
c.JupyterHub.hub_port = 8081
26+
27+
c.NativeAuthenticator.open_signup = True
28+
c.NativeAuthenticator.allow_all = True

tutorial/jupyterhub/setting.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if [ -z "$(docker network ls | grep jupyterhub-network)" ]; then
2+
docker network create jupyterhub-network
3+
fi
4+
5+
docker compose up -d --build

0 commit comments

Comments
 (0)