-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-container.sh
More file actions
executable file
·41 lines (36 loc) · 1.14 KB
/
dev-container.sh
File metadata and controls
executable file
·41 lines (36 loc) · 1.14 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
#!/usr/bin/env bash
source ./dev.conf
USERNAME="$USER"
GPU_FLAG=""
NETWORK_FLAG=""
# Check if the 'cicd-net' network exists
if docker network ls | grep -q "cicd-net"; then
echo "--- Attaching to 'cicd-net' network ---"
NETWORK_FLAG="--network cicd-net"
else
echo "--- 'cicd-net' network not found. Attaching to default network. ---"
fi
# Conditionally add the --gpus flag
if [ "$ENABLE_GPU_SUPPORT" = "true" ]; then
GPU_FLAG="--gpus all"
fi
# Create our persistent directories on the host if they don't exist.
# This ensures they are created with the correct host user permissions.
mkdir -p repos data articles viewer
docker run -it \
--name "dev-container" \
--restart always \
$NETWORK_FLAG \
--cap-add=SYS_NICE \
--cap-add=SYS_PTRACE \
$GPU_FLAG \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)/articles:/home/$USERNAME/articles" \
-v "$(pwd)/viewer:/home/$USERNAME/viewer" \
-v "$(pwd)/data:/home/$USERNAME/data" \
-v "$(pwd)/repos:/home/$USERNAME/repos" \
-v "$(pwd)/entrypoint.sh:/entrypoint.sh" \
-p 127.0.0.1:10200:22 \
-p 127.0.0.1:10201:8888 \
-p 127.0.0.1:10202:8889 \
dev-container:latest