-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e67c4e
commit be18852
Showing
12 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
mkdir -p /config/{extensions,data,workspace,.ssh} | ||
|
||
if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then | ||
echo "setting up sudo access" | ||
if ! grep -q 'abc' /etc/sudoers; then | ||
echo "adding abc to sudoers" | ||
echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers | ||
fi | ||
if [ -n "${SUDO_PASSWORD_HASH}" ]; then | ||
echo "setting sudo password using sudo password hash" | ||
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow | ||
else | ||
echo "setting sudo password using SUDO_PASSWORD env var" | ||
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc | ||
fi | ||
fi | ||
|
||
[[ ! -f /config/.bashrc ]] && \ | ||
cp /root/.bashrc /config/.bashrc | ||
[[ ! -f /config/.profile ]] && \ | ||
cp /root/.profile /config/.profile | ||
|
||
# fix permissions (ignore contents of /config/workspace) | ||
find /config -path /config/workspace -prune -o -exec chown abc:abc {} + | ||
chown abc:abc /config/workspace | ||
chmod 700 /config/.ssh | ||
if [ -n "$(ls -A /config/.ssh)" ]; then | ||
chmod 600 /config/.ssh/* | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-code-server/run |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
docker/root/etc/s6-overlay/s6-rc.d/svc-code-server/notification-fd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
if [ -n "${PASSWORD}" ] || [ -n "${HASHED_PASSWORD}" ]; then | ||
AUTH="password" | ||
else | ||
AUTH="none" | ||
echo "starting with no password" | ||
fi | ||
|
||
if [ -z ${PROXY_DOMAIN+x} ]; then | ||
PROXY_DOMAIN_ARG="" | ||
else | ||
PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}" | ||
fi | ||
|
||
exec \ | ||
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 8443" \ | ||
s6-setuidgid abc \ | ||
/app/code-server/bin/code-server \ | ||
--bind-addr 0.0.0.0:8443 \ | ||
--user-data-dir /config/data \ | ||
--extensions-dir /config/extensions \ | ||
--disable-telemetry \ | ||
--auth "${AUTH}" \ | ||
"${PROXY_DOMAIN_ARG}" \ | ||
"${DEFAULT_WORKSPACE:-/config/workspace}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
_install=(/app/code-server/bin/code-server "--extensions-dir" "/config/extensions" "--install-extension") | ||
|
||
if [ "$(whoami)" == "abc" ]; then | ||
"${_install[@]}" "$@" | ||
else | ||
s6-setuidgid abc "${_install[@]}" "$@" | ||
fi |