|
1 |
| -# syntax=docker/dockerfile:1 |
2 |
| - |
3 |
| -# Based on https://gist.githubusercontent.com/usr-ein/c42d98abca3cb4632ab0c2c6aff8c88a/raw/19dcc899f68d0b08c2c137d3fd01715b0c84bac9/Dockerfile |
4 |
| - |
5 |
| -################################ |
6 |
| -# PYTHON-BASE |
7 |
| -# Sets up all our shared environment variables |
8 |
| -################################ |
9 |
| -FROM --platform=$TARGETPLATFORM linuxserver/code-server:latest AS python-base |
10 |
| - |
11 |
| -ARG TARGETPLATFORM |
12 |
| - |
13 |
| -# python |
14 |
| -ENV PYTHONUNBUFFERED=1 \ |
15 |
| - # prevents python creating .pyc files |
16 |
| - PYTHONDONTWRITEBYTECODE=1 \ |
17 |
| - \ |
18 |
| - # pip |
19 |
| - PIP_DISABLE_PIP_VERSION_CHECK=on \ |
20 |
| - PIP_DEFAULT_TIMEOUT=100 \ |
21 |
| - \ |
22 |
| - # paths |
23 |
| - # this is where our requirements + virtual environment will live |
24 |
| - PYSETUP_PATH="/opt/pysetup" \ |
25 |
| - VENV_PATH="/opt/pysetup/.venv" |
26 |
| - |
27 |
| - |
28 |
| -################################ |
29 |
| -# BUILDER-BASE |
30 |
| -# Used to build deps + create our virtual environment |
31 |
| -################################ |
32 |
| -FROM python-base AS builder-base |
| 1 | +# Start from the linuxserver/code-server image. |
| 2 | +FROM --platform=$TARGETPLATFORM linuxserver/code-server:latest |
33 | 3 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
34 | 4 |
|
| 5 | +ENV PUID=0 |
| 6 | +ENV PGID=0 |
| 7 | +ENV DEFAULT_WORKSPACE=/workspace |
| 8 | + |
| 9 | +# Switch to root to install additional packages. |
| 10 | +USER root |
| 11 | + |
| 12 | +# Install Docker engine (docker.io). |
35 | 13 | RUN apt-get update && \
|
36 |
| - apt-get install -y curl bash-completion \ |
37 |
| - software-properties-common \ |
38 |
| - build-essential && \ |
39 |
| - add-apt-repository ppa:deadsnakes/ppa && \ |
40 |
| - apt-get update && \ |
41 |
| - apt-get install -y python3.12 python3.12-venv python3.12-dev && \ |
42 |
| - apt-get clean && \ |
| 14 | + apt-get install -y docker.io \ |
| 15 | + build-essential \ |
| 16 | + gcc \ |
| 17 | + g++ \ |
| 18 | + clang \ |
| 19 | + make \ |
| 20 | + meson \ |
| 21 | + ninja-build && \ |
| 22 | + apt-get clean &&\ |
43 | 23 | rm -rf /var/lib/apt/lists/*
|
44 | 24 |
|
45 |
| -RUN curl -fsSL https://get.docker.com | sh |
| 25 | +# Create the Docker daemon socket directory, if needed. |
| 26 | +RUN mkdir -p /var/run |
46 | 27 |
|
47 |
| -# Expose the port used by code-server |
| 28 | +# Expose only the code-server port (adjust based on your configuration). |
48 | 29 | EXPOSE 8443
|
49 | 30 |
|
| 31 | +# Copy the custom entrypoint script. |
| 32 | +COPY docker-entrypoint.sh /docker-entrypoint.sh |
| 33 | +RUN chmod +x /docker-entrypoint.sh |
| 34 | + |
| 35 | +SHELL ["/bin/bash", "-c"] |
| 36 | +WORKDIR /workspace |
| 37 | +ENV PATH="/app/code-server/bin:${PATH}" |
| 38 | + |
| 39 | +RUN code-server --install-extension ms-python.python |
| 40 | + |
| 41 | + |
| 42 | +ADD pyproject.toml . |
| 43 | +ADD settings.json .vscode/settings.json |
| 44 | + |
| 45 | +RUN uv venv .venv |
| 46 | +RUN source .venv/bin/activate |
| 47 | +RUN uv sync --active |
| 48 | + |
| 49 | + |
| 50 | +# Use our entrypoint script to launch Docker daemon and then code-server. |
| 51 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
50 | 52 |
|
51 |
| -RUN /app/code-server/bin/code-server --install-extension ms-python.python |
| 53 | +# The default command provided by linuxserver initiates code-server. |
| 54 | +CMD ["/init"] |
0 commit comments