1- FROM --platform=linux/amd64 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,63 @@ 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 \
35- && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
40+ && 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 \
43+ && ACCEPT_EULA=Y apt-get install -y --no-install-recommends \
3944 msodbcsql18 \
40- mssql-tools \
41- unixodbc-dev \
42- && apt-get install -y azure-cli \
43- && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /etc/profile.d/sqltools.sh \
44- && apt-get clean \
45- && rm -rf /var/lib/apt/lists/*
45+ mssql-tools18 \
46+ && echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> /etc/profile.d/sqltools.sh
4647
4748# audio back-ends needed by Azure Speech SDK
48- RUN apt-get update \
49- && DEBIAN_FRONTEND=noninteractive \
50- 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 \
5153 libasound2 \
52- libpulse0 \
53- && rm -rf /var/lib/apt/lists/*
54+ libpulse0
5455
5556# Install uv system-wide and create pyrit-dev venv
56- RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
57- && mv /root/.local/bin/uv /usr/local/bin/uv \
58- && rm -rf /opt/venv \
59- && uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
60- && chown -R vscode:vscode /opt/venv \
61- && ls -la /opt/venv/bin/activate
57+ RUN curl -LsSf https://astral.sh/uv/0.10.8/install.sh | sh \
58+ && mv /root/.local/bin/uv /bin/uv \
59+ && mv /root/.local/bin/uvx /bin/uvx
60+ RUN uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
61+ && chown -R vscode:vscode /opt/venv
6262ENV PATH="/opt/venv/bin:$PATH"
6363
64+ # Install Node.js 24.x LTS for frontend development
65+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
66+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
67+ curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
68+ && apt-get install -y --no-install-recommends nodejs
69+
6470# vscode user already exists in the base image, just ensure sudo access
6571RUN echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
6672
67- # Install Node.js 20.x and npm for frontend development
68- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
69- && apt-get install -y nodejs \
70- && npm install -g npm@latest \
71- && apt-get clean \
72- && rm -rf /var/lib/apt/lists/*
73-
7473# Pre-create common user caches and fix permissions
7574RUN mkdir -p /home/vscode/.cache/pre-commit \
7675 && mkdir -p /home/vscode/.vscode-server \
@@ -79,7 +78,7 @@ RUN mkdir -p /home/vscode/.cache/pre-commit \
7978 && mkdir -p /home/vscode/.cache/venv \
8079 && mkdir -p /home/vscode/.cache/pylance \
8180 && 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\
81+ && chmod -R 755 /home/vscode/.cache/pip /home/vscode/.cache/pylance /home/vscode/.cache/venv /home/vscode/.cache/uv \
8382 && chmod -R 755 /home/vscode/.vscode-server
8483
8584USER vscode
@@ -95,6 +94,6 @@ RUN git config --global core.preloadindex true \
9594 && git config --global status.showUntrackedFiles all \
9695 && git config --global core.fsmonitor true
9796
98- # Set cache directories so they can be mounted
97+ # Set cache directories so they can be mounted
9998ENV PIP_CACHE_DIR="/home/vscode/.cache/pip"
10099ENV UV_CACHE_DIR="/home/vscode/.cache/uv"
0 commit comments