From ccb7c4407ca8a0f44baf08497db9ea5783647cfb Mon Sep 17 00:00:00 2001 From: Kharec Date: Wed, 3 Dec 2025 19:46:55 +0100 Subject: [PATCH] feat: migrate from venv to uv --- Dockerfile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3daa13..b43714d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM python:3.12-alpine +FROM ghcr.io/astral-sh/uv:python3.12-alpine ARG FLADO_DATABASE_URI=sqlite:////app/instance/flado.sqlite ENV PYTHONDONTWRITEBYTECODE=1 \ - PYTHONUNBUFFERED=1 \ - FLASK_APP=flado.app:create_app \ - FLADO_DATABASE_URI=${FLADO_DATABASE_URI} + PYTHONUNBUFFERED=1 \ + FLASK_APP=flado.app:create_app \ + FLADO_DATABASE_URI=${FLADO_DATABASE_URI} \ + VIRTUAL_ENV=/app/.venv \ + PATH="/app/.venv/bin:$PATH" WORKDIR /app @@ -14,12 +16,9 @@ RUN addgroup -S app && adduser -S app -G app # Install curl for healthcheck RUN apk add --no-cache curl -COPY requirements.txt . - -RUN pip install --no-cache-dir -r requirements.txt - -COPY . . +COPY . ./ +RUN uv sync --frozen --no-dev --no-cache RUN mkdir -p /app/instance && chown -R app:app /app/instance VOLUME ["/app/instance"] @@ -31,4 +30,4 @@ EXPOSE 5000 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl --fail --silent --show-error http://localhost:5000/health || exit 1 -CMD ["sh", "-c", "mkdir -p /app/instance && flask db upgrade && gunicorn --bind 0.0.0.0:5000 --workers 2 --timeout 120 --access-logfile - --error-logfile - wsgi:app"] +CMD ["sh", "-c", "mkdir -p /app/instance && uv run flask db upgrade && gunicorn --bind 0.0.0.0:5000 --workers 2 --timeout 120 --access-logfile - --error-logfile - wsgi:app"]