mirror of
https://github.com/tiennm99/composes.git
synced 2026-10-11 03:13:16 +00:00
- Install the Docker CLI with its Compose and Buildx plugins, and the GitHub CLI, from Docker's and GitHub's signed apt repositories; drop their home installs and the GitLab CLI from the README. - Select the shell with SHELL and the start folder with DEFAULT_WORKSPACE instead of chsh and working_dir. - Add an optional CODE_SERVER_APP_NAME. - Document installing Java with SDKMAN.
27 lines
765 B
Bash
Executable File
27 lines
765 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
# Start in DEFAULT_WORKSPACE, the folder code-server opens.
|
|
if [ -n "${DEFAULT_WORKSPACE:-}" ]; then
|
|
cd "$DEFAULT_WORKSPACE"
|
|
fi
|
|
|
|
# Add coder to the group that owns the mounted Docker socket, then restart
|
|
# under that group.
|
|
if [ -S /var/run/docker.sock ]; then
|
|
gid=$(stat -c %g /var/run/docker.sock)
|
|
if ! id -G | tr ' ' '\n' | grep -qx "$gid"; then
|
|
group=$(getent group "$gid" | cut -d: -f1)
|
|
if [ -z "$group" ]; then
|
|
group=docker-host
|
|
sudo groupadd -g "$gid" "$group"
|
|
fi
|
|
sudo usermod -aG "$group" coder
|
|
exec sudo -E setpriv --reuid=coder --regid=coder --init-groups \
|
|
env PATH="$PATH" USER=coder /usr/bin/entrypoint.sh "$@"
|
|
fi
|
|
fi
|
|
|
|
# Start the image's own entrypoint.
|
|
exec /usr/bin/entrypoint.sh "$@"
|