mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
refactor: update API Dockerfile to use uv for dependency management
This commit is contained in:
parent
068e927508
commit
09f3078f2b
1 changed files with 8 additions and 25 deletions
|
|
@ -1,30 +1,13 @@
|
||||||
# Use an official Python runtime as a parent image
|
FROM python:3.12-slim-bookworm
|
||||||
FROM python:3.12.3-slim
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
# Set environment variables
|
# Copy the project into the image
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ADD . /app
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
PIP_NO_CACHE_DIR=off \
|
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=on
|
|
||||||
|
|
||||||
# Set work directory
|
# Sync the project into a new environment, using the frozen lockfile
|
||||||
WORKDIR /usr/learnhouse-api
|
WORKDIR /app
|
||||||
|
RUN uv sync --frozen
|
||||||
|
|
||||||
# Install system dependencies and Poetry
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
gcc \
|
|
||||||
build-essential \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& pip install --no-cache-dir uv
|
|
||||||
|
|
||||||
# Copy only requirements to cache them in docker layer
|
|
||||||
COPY uv.lock pyproject.toml ./
|
|
||||||
|
|
||||||
# Install dependencies using uv
|
|
||||||
RUN uv sync
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["python", "app.py"]
|
CMD ["uv", "run", "app.py"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue