54 lines
2.9 KiB
Docker
54 lines
2.9 KiB
Docker
# Fellowship code-server IDE
|
|
# Extends codercom/code-server with:
|
|
# - Docker CLI + Compose v2 plugin (so students can run docker compose from the IDE terminal)
|
|
# - Pre-installed VS Code extensions (Python, Playwright, Copilot, Jupyter, Prettier)
|
|
# - Runtime entrypoint that aligns the docker group GID with the host socket
|
|
|
|
FROM codercom/code-server:latest
|
|
|
|
USER root
|
|
|
|
# ── System packages ──────────────────────────────────────────────────────────
|
|
# docker.io provides the Docker CLI (client only); the daemon runs on the host.
|
|
# gosu is used in the entrypoint to drop privileges cleanly back to coder.
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
docker.io \
|
|
gosu \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Docker Compose v2 plugin ─────────────────────────────────────────────────
|
|
# Install as a CLI plugin AND as a standalone binary so both
|
|
# `docker compose ...` and `docker-compose ...` work from the terminal.
|
|
RUN mkdir -p /usr/local/lib/docker/cli-plugins && \
|
|
curl -fsSL \
|
|
"https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64" \
|
|
-o /usr/local/lib/docker/cli-plugins/docker-compose && \
|
|
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose && \
|
|
ln -sf /usr/local/lib/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose && \
|
|
ln -sf /usr/local/lib/docker/cli-plugins/docker-compose /usr/local/bin/docker compose || true
|
|
|
|
# Make the CLI plugin available to the coder user too
|
|
RUN mkdir -p /home/coder/.docker/cli-plugins && \
|
|
ln -sf /usr/local/lib/docker/cli-plugins/docker-compose \
|
|
/home/coder/.docker/cli-plugins/docker-compose && \
|
|
chown -R coder:coder /home/coder/.docker
|
|
|
|
# ── Docker group ─────────────────────────────────────────────────────────────
|
|
# Pre-create the docker group with GID 999 (common default).
|
|
# The entrypoint will re-align the GID at runtime to match the host socket.
|
|
RUN groupadd -g 999 docker 2>/dev/null || groupmod -g 999 docker 2>/dev/null || true && \
|
|
usermod -aG docker coder
|
|
|
|
# ── Runtime entrypoint ───────────────────────────────────────────────────────
|
|
COPY entrypoint.sh /usr/bin/fellowship-docker-init.sh
|
|
RUN chmod +x /usr/bin/fellowship-docker-init.sh
|
|
|
|
# Run as root initially so the entrypoint can fix group GIDs.
|
|
# The entrypoint drops back to 'coder' via gosu before starting code-server.
|
|
USER root
|
|
|
|
ENTRYPOINT ["/usr/bin/fellowship-docker-init.sh"]
|