Skip to content

Commit 84c3d57

Browse files
committed
Add python dev package with dead snakes
1 parent 7323d13 commit 84c3d57

4 files changed

+5
-3
lines changed

src/fastapi/docker_files.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ RUN : \
484484
&& apt-get update \
485485
&& apt-get install -y --no-install-recommends \
486486
python{python_version} \
487+
python{python_version}-dev \
487488
&& apt-get clean \
488489
&& rm -rf /var/lib/apt/lists/*
489490
@@ -716,6 +717,7 @@ RUN : \
716717
&& apt-get update \
717718
&& apt-get install -y --no-install-recommends \
718719
python{python_version} \
720+
python{python_version}-dev \
719721
python{python_version}-venv \
720722
&& apt-get clean \
721723
&& rm -rf /var/lib/apt/lists/*

src/fastapi/snapshots/python_project__fastapi__docker_files__tests__save_dockerfile_maturin_setuptools.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/fastapi/docker_files.rs
33
expression: content
44
---
5-
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n UV_PYTHON_INSTALL_DIR=/opt/uv/python \\\n UV_LINK_MODE=copy\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n build-essential \\\n curl \\\n ca-certificates \\\n libssl-dev \\\n pkg-config \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n python3.11-venv \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install uv\nADD https://astral.sh/uv/install.sh /uv-installer.sh\n\nRUN sh /uv-installer.sh && rm /uv-installer.sh\n\n# Install rust\nRUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal\n\nENV PATH=\"/root/.local/bin:/root/.cargo/bin:$PATH\"\n\n# Create virtual environment\nRUN python3.11 -m venv .venv\n\nCOPY pyproject.toml Cargo.toml Cargo.lock README.md LICENSE ./\nCOPY src/ ./src\nRUN mkdir my_project\n\nRUN --mount=type=cache,target=/app/target/ \\\n --mount=type=cache,target=/usr/local/cargo/git/db \\\n --mount=type=cache,target=/usr/local/cargo/registry/ \\\n uv tool run maturin develop -r\n\nCOPY requirements.txt ./\n\nRUN --mount=type=cache,target=/root/.cache/uv \\\n .venv/bin/python -m pip install -r requirements.txt\n\nCOPY . /app\n\n\nRUN --mount=type=cache,target=/usr/local/cargo/git/db \\\n --mount=type=cache,target=/usr/local/cargo/registry/ \\\n .venv/bin/python -m pip install -r requirements.txt \\\n && uv tool run maturin develop -r\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"
5+
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n UV_PYTHON_INSTALL_DIR=/opt/uv/python \\\n UV_LINK_MODE=copy\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n build-essential \\\n curl \\\n ca-certificates \\\n libssl-dev \\\n pkg-config \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n python3.11-dev \\\n python3.11-venv \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install uv\nADD https://astral.sh/uv/install.sh /uv-installer.sh\n\nRUN sh /uv-installer.sh && rm /uv-installer.sh\n\n# Install rust\nRUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal\n\nENV PATH=\"/root/.local/bin:/root/.cargo/bin:$PATH\"\n\n# Create virtual environment\nRUN python3.11 -m venv .venv\n\nCOPY pyproject.toml Cargo.toml Cargo.lock README.md LICENSE ./\nCOPY src/ ./src\nRUN mkdir my_project\n\nRUN --mount=type=cache,target=/app/target/ \\\n --mount=type=cache,target=/usr/local/cargo/git/db \\\n --mount=type=cache,target=/usr/local/cargo/registry/ \\\n uv tool run maturin develop -r\n\nCOPY requirements.txt ./\n\nRUN --mount=type=cache,target=/root/.cache/uv \\\n .venv/bin/python -m pip install -r requirements.txt\n\nCOPY . /app\n\n\nRUN --mount=type=cache,target=/usr/local/cargo/git/db \\\n --mount=type=cache,target=/usr/local/cargo/registry/ \\\n .venv/bin/python -m pip install -r requirements.txt \\\n && uv tool run maturin develop -r\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"

src/fastapi/snapshots/python_project__fastapi__docker_files__tests__save_dockerfile_poetry.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/fastapi/docker_files.rs
33
expression: content
44
---
5-
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n POETRY_NO_INTERACTION=true \\\n POETRY_VIRTUALENVS_IN_PROJECT=true \\\n POETRY_CACHE_DIR=/tmp/poetry_cache\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n curl \\\n ca-certificates \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install Poetry\nRUN curl -sSL https://install.python-poetry.org | python3.11 -\n\nENV PATH=\"/root/.local/bin:$PATH\"\n\nCOPY pyproject.toml poetry.lock ./\n\nCOPY . ./\n\nRUN --mount=type=cache,target=$POETRY_CACHE_DIR \\\n poetry config virtualenvs.in-project true \\\n && poetry install --only=main\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends\\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends python3.11 \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"
5+
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n POETRY_NO_INTERACTION=true \\\n POETRY_VIRTUALENVS_IN_PROJECT=true \\\n POETRY_CACHE_DIR=/tmp/poetry_cache\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n build-essential \\\n curl \\\n ca-certificates \\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n python3.11 \\\n python3.11-dev \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install Poetry\nRUN curl -sSL https://install.python-poetry.org | python3.11 -\n\nENV PATH=\"/root/.local/bin:$PATH\"\n\nCOPY pyproject.toml poetry.lock ./\n\nCOPY . ./\n\nRUN --mount=type=cache,target=$POETRY_CACHE_DIR \\\n poetry config virtualenvs.in-project true \\\n && poetry install --only=main\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends\\\n software-properties-common \\\n && add-apt-repository ppa:deadsnakes/ppa \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends python3.11 \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"

src/fastapi/snapshots/python_project__fastapi__docker_files__tests__save_dockerfile_uv.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/fastapi/docker_files.rs
33
expression: content
44
---
5-
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n UV_PYTHON_INSTALL_DIR=/opt/uv/python \\\n UV_LINK_MODE=copy\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n curl \\\n ca-certificates \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install uv\nADD https://astral.sh/uv/install.sh /uv-installer.sh\n\nRUN sh /uv-installer.sh && rm /uv-installer.sh\n\nENV PATH=\"/root/.local/bin:$PATH\"\n\n# Create virtual environment and download Python\nRUN uv venv -p 3.11\n\nCOPY . ./\n\nRUN --mount=type=cache,target=/root/.cache/uv \\\n uv sync --locked --no-dev --no-editable\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY --from=builder /opt/uv/python /opt/uv/python\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"
5+
"# syntax=docker/dockerfile:1\n\nFROM ubuntu:24.04 AS builder\n\nWORKDIR /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n UV_PYTHON_INSTALL_DIR=/opt/uv/python \\\n UV_LINK_MODE=copy\n\nRUN : \\\n && apt-get update \\\n && apt-get install -y --no-install-recommends \\\n build-essential \\\n curl \\\n ca-certificates \\\n && apt-get clean \\\n && rm -rf /var/lib/apt/lists/*\n\n# Install uv\nADD https://astral.sh/uv/install.sh /uv-installer.sh\n\nRUN sh /uv-installer.sh && rm /uv-installer.sh\n\nENV PATH=\"/root/.local/bin:$PATH\"\n\n# Create virtual environment and download Python\nRUN uv venv -p 3.11\n\nCOPY . ./\n\nRUN --mount=type=cache,target=/root/.cache/uv \\\n uv sync --locked --no-dev --no-editable\n\n\n# Build production stage\nFROM ubuntu:24.04 AS prod\n\nRUN useradd appuser\n\nWORKDIR /app\n\nRUN chown appuser:appuser /app\n\nENV \\\n PYTHONUNBUFFERED=true \\\n PATH=\"/app/.venv/bin:$PATH\" \\\n PORT=\"8000\"\n\nCOPY --from=builder /app/.venv /app/.venv\nCOPY --from=builder /app/my_project /app/my_project\nCOPY --from=builder /opt/uv/python /opt/uv/python\nCOPY ./scripts/entrypoint.sh /app\n\nRUN chmod +x /app/entrypoint.sh\n\nEXPOSE 8000\n\nUSER appuser\n\nENTRYPOINT [\"./entrypoint.sh\"]\n"

0 commit comments

Comments
 (0)