1- FROM mcr.microsoft.com/devcontainers/python:3.11
1+ # syntax=docker/dockerfile:1
2+ FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm
23
34# Makes installation faster
45ENV UV_COMPILE_BYTECODE=1
6+ ENV DEBIAN_FRONTEND=noninteractive
57
68SHELL ["/bin/bash" , "-c" ]
79
@@ -11,66 +13,61 @@ USER root
1113RUN rm -f /etc/apt/sources.list.d/yarn.list 2>/dev/null || true
1214
1315# Install required system packages + ODBC prerequisites
14- RUN apt-get update && apt-get install -y \
15- sudo \
16- unixodbc \
17- unixodbc-dev \
18- libgl1 \
19- git \
20- curl \
21- xdg-utils \
22- build-essential \
23- && apt-get clean && rm -rf /var/lib/apt/lists/*
16+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
17+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
18+ apt-get update \
19+ && apt-get install -y --no-install-recommends \
20+ sudo \
21+ unixodbc \
22+ unixodbc-dev \
23+ libgl1 \
24+ git \
25+ curl \
26+ xdg-utils \
27+ build-essential
2428
25- # Install the Azure CLI, Microsoft ODBC Driver 18 & SQL tools
29+ # Install Microsoft ODBC Driver 18 & SQL tools
2630# Note: Debian Trixie's sqv rejects SHA1 signatures, so we use gpg directly to import the Microsoft key
27- RUN apt-get update && apt-get install -y \
28- apt-transport-https \
31+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
32+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
33+ apt-get update \
34+ && apt-get install -y --no-install-recommends \
2935 ca-certificates \
3036 gnupg \
31- lsb-release \
3237 && curl -sL https://packages.microsoft.com/keys/microsoft.asc \
3338 | gpg --dearmor \
3439 > /usr/share/keyrings/microsoft-archive-keyring.gpg \
3540 && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
3641 > /etc/apt/sources.list.d/microsoft.list \
3742 && apt-get update \
38- && ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 \
39- && apt-get install -y azure-cli \
40- && echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> /etc/profile.d/sqltools.sh \
41- && apt-get clean \
42- && rm -rf /var/lib/apt/lists/*
43+ && ACCEPT_EULA=Y apt-get install -y --no-install-recommends \
44+ msodbcsql18 \
45+ mssql-tools18 \
46+ && echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> /etc/profile.d/sqltools.sh
4347
4448# audio back-ends needed by Azure Speech SDK
45- RUN apt-get update \
46- && DEBIAN_FRONTEND=noninteractive \
47- apt-get install -y --no-install-recommends \
49+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
50+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
51+ apt-get update \
52+ && apt-get install -y --no-install-recommends \
4853 libasound2 \
49- libpulse0 \
50- && rm -rf /var/lib/apt/lists/*
54+ libpulse0
5155
5256# Install uv system-wide and create pyrit-dev venv
53- RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
54- && mv /root/.local/bin/uv /usr/local/bin/uv \
55- && rm -rf /opt/venv \
56- && uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
57- && chown -R vscode:vscode /opt/venv \
58- && ls -la /opt/venv/bin/activate
57+ COPY --from=ghcr.io/astral-sh/uv:0.10.8 /uv /uvx /bin/
58+ RUN uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
59+ && chown -R vscode:vscode /opt/venv
5960ENV PATH="/opt/venv/bin:$PATH"
6061
62+ # Install Node.js 24.x LTS for frontend development
63+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
64+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
65+ curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
66+ && apt-get install -y --no-install-recommends nodejs
67+
6168# vscode user already exists in the base image, just ensure sudo access
6269RUN echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
6370
64- # Install Node.js 20.x and npm for frontend development
65- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
66- && apt-get install -y nodejs \
67- && npm install -g npm@latest \
68- && npm install -g @github/copilot@0.0.421 \
69- && npm cache clean --force \
70- && rm -rf /root/.npm \
71- && apt-get clean \
72- && rm -rf /var/lib/apt/lists/*
73-
7471# Pre-create common user caches and fix permissions
7572RUN mkdir -p /home/vscode/.cache/pre-commit \
7673 && mkdir -p /home/vscode/.vscode-server \
@@ -79,7 +76,7 @@ RUN mkdir -p /home/vscode/.cache/pre-commit \
7976 && mkdir -p /home/vscode/.cache/venv \
8077 && mkdir -p /home/vscode/.cache/pylance \
8178 && chown -R vscode:vscode /home/vscode/.cache /home/vscode/.vscode-server \
82- && chmod -R 777 /home/vscode/.cache/pip /home/vscode/.cache/pylance /home/vscode/.cache/venv /home/vscode/.cache/uv\
79+ && chmod -R 755 /home/vscode/.cache/pip /home/vscode/.cache/pylance /home/vscode/.cache/venv /home/vscode/.cache/uv \
8380 && chmod -R 755 /home/vscode/.vscode-server
8481
8582USER vscode
@@ -95,6 +92,6 @@ RUN git config --global core.preloadindex true \
9592 && git config --global status.showUntrackedFiles all \
9693 && git config --global core.fsmonitor true
9794
98- # Set cache directories so they can be mounted
95+ # Set cache directories so they can be mounted
9996ENV PIP_CACHE_DIR="/home/vscode/.cache/pip"
10097ENV UV_CACHE_DIR="/home/vscode/.cache/uv"
0 commit comments