Alina Lozovskaya commited on
Commit
2620acf
1 Parent(s): f1e551a

Use uv for dependencies and runtime

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -8,23 +8,22 @@ COPY frontend/ ./
8
  RUN npm run build
9
 
10
  # Build backend
11
- FROM python:3.9-slim
 
12
  WORKDIR /app
13
 
14
  # Create non-root user
15
  RUN useradd -m -u 1000 user
16
 
17
- # Install poetry
18
- RUN pip install poetry
19
-
20
  # Create and configure cache directory
21
  RUN mkdir -p /app/.cache && \
22
  chown -R user:user /app
23
 
24
- # Copy and install backend dependencies
25
- COPY backend/pyproject.toml backend/poetry.lock* ./
26
- RUN poetry config virtualenvs.create false \
27
- && poetry install --no-interaction --no-ansi --no-root --only main
 
28
 
29
  # Copy backend code
30
  COPY backend/ .
@@ -60,4 +59,4 @@ USER user
60
  EXPOSE 7860
61
 
62
  # Start both servers with wait-for
63
- CMD ["sh", "-c", "uvicorn app.asgi:app --host 0.0.0.0 --port 7861 & while ! nc -z localhost 7861; do sleep 1; done && cd frontend && npm run serve"]
 
8
  RUN npm run build
9
 
10
  # Build backend
11
+ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
12
+
13
  WORKDIR /app
14
 
15
  # Create non-root user
16
  RUN useradd -m -u 1000 user
17
 
 
 
 
18
  # Create and configure cache directory
19
  RUN mkdir -p /app/.cache && \
20
  chown -R user:user /app
21
 
22
+ # Copy uv configuration files
23
+ COPY backend/pyproject.toml backend/uv.lock ./
24
+
25
+ # Install dependencies using uv
26
+ RUN uv sync --all-extras --frozen
27
 
28
  # Copy backend code
29
  COPY backend/ .
 
59
  EXPOSE 7860
60
 
61
  # Start both servers with wait-for
62
+ CMD ["sh", "-c", "uv run uvicorn app.asgi:app --host 0.0.0.0 --port 7861 & while ! nc -z localhost 7861; do sleep 1; done && cd frontend && npm run serve"]