-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint
58 lines (49 loc) · 1.53 KB
/
entrypoint
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
54
55
56
57
58
#!/bin/bash
# This is the entrypoint script for the code-server Docker image
# It allows you to configure code-server using environment variables
# It is meant to run on a Fedora-based image
server="code-server -w MONKESERVER -an MonkeServer --disable-telemetry"
# Check $AUTHENTICATION_MODE variable
if [ "$AUTHENTICATION_MODE" = "password" ]; then
# Start code-server with password
server+=" --auth password"
elif [ "$AUTHENTICATION_MODE" = "none" ]; then
server+=" --auth none"
fi
# Check $PASSWORD variable
# Check $HTTPS variable
if [ -n "$HTTPS" ]; then
# Check /certs directory exists and is not empty
if [ -d "/certs" ] && [ "$(ls -A /certs)" ]; then
# Start code-server with HTTPS
server+=" --cert /certs/cert.pem --cert-key /certs/key.pem"
fi
fi
# Check $PORT variable
if [ -n "$PORT" ]; then
server+=" --bind-addr 0.0.0.0:$PORT"
else
server+=" --bind-addr 0.0.0.0:8443"
fi
# Check $GITHUB_TOKEN variable
if [ -n "$GITHUB_TOKEN" ]; then
server+=" --github-auth $GITHUB_TOKEN"
fi
# Variable $EXTENSIONS is a list of extensions separated by pipe "|"
# Check $EXTENSIONS variable
#if [ -n "$EXTENSIONS" ]; then
# # Split $EXTENSIONS by "|"
# IFS='|' read -ra EXTENSIONS <<< "$EXTENSIONS"
# # Loop through $EXTENSIONS
# for extension in "${EXTENSIONS[@]}"; do
# # Install extension
# server+=" --install-extension $extension"
# done
#fi
server+=" /home/monke/workspaces"
# Start code-server
if [ -n "$DEBUG" ]; then
echo "Starting code-server with command: $server"
fi
sudo chown -R monke:monke .
exec $server