Refactor Dockerfile to use Python image from Astral instead of Python and remove unnecessary git installation

This commit is contained in:
2025-04-14 09:44:51 +02:00
parent 9ab2ba8aec
commit 66c0132c1b

View File

@ -1,9 +1,6 @@
# Install uv # syntax=docker/dockerfile:1
FROM python:3.13-slim # check=error=true
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim@sha256:73c021c3fe7264924877039e8a449ad3bb380ec89214282301affa9b2f863c5d
# Install git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Change the working directory to the `app` directory # Change the working directory to the `app` directory
WORKDIR /app WORKDIR /app
@ -13,9 +10,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --no-install-project uv sync --no-install-project
# Uninstall git to reduce image size
RUN apt-get purge -y --auto-remove git
# Copy the application files # Copy the application files
ADD main.py misc.py settings.py /app/ ADD main.py misc.py settings.py /app/