Files
composes/code-server/entrypoint.sh
T
tiennm99 c1ef9e7680 feat(code-server): install Docker CLI and gh from vendor apt repos
- 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.
2026-10-06 13:39:31 +07:00

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 "$@"