-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·53 lines (46 loc) · 1.65 KB
/
entrypoint.sh
File metadata and controls
executable file
·53 lines (46 loc) · 1.65 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
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
sudo service ssh restart
CA_CERT_PATH="data/ca-cert.pem"
if [ -f "$CA_CERT_PATH" ]; then
echo "--- Found Local CA certificate, installing to system trust store ---"
# Copy the CA cert into the system's trust store
sudo cp "$CA_CERT_PATH" /usr/local/share/ca-certificates/cicd-stack-ca.crt
# Update the system's CA list
sudo update-ca-certificates
else
echo "--- No Local CA certificate found at $CA_CERT_PATH, skipping system trust ---"
fi
# Check for GPG key and gitconfig on the persistent data volume
if [ -e data/private.pgp ]; then
gpg --import data/private.pgp
fi
if [ -e data/.gitconfig ]; then
cp data/.gitconfig ~/.gitconfig
fi
# Generate a self-signed TLS certificate for JupyterLab if one doesn't exist
if [ ! -f "data/cert.pem" ] || [ ! -f "data/key.pem" ]; then
echo "--- Generating self-signed TLS certificate for JupyterLab and Docs server ---"
openssl req -x509 \
-nodes \
-newkey rsa:4096 \
-keyout data/key.pem \
-out data/cert.pem \
-sha256 \
-days 365 \
-subj '/CN=localhost'
fi
if [ ! -d "viewer/.venv" ]; then
echo "--- Creating viewer venv ---"
(
cd viewer || exit
python3.12 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r requirements.txt
)
fi
# Activate venv and start JupyterLab in a detached tmux session
. .venv_jupyter/bin/activate
tmux new -d -s jupyterlab "jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --certfile=data/cert.pem --keyfile=data/key.pem"
tmux new -d -s docs "cd ~/viewer && . .venv/bin/activate && python3 server.py"
# Execute the command passed to `docker run`, or default to bash
bash