Skip to content

Commit 00ecb0f

Browse files
committed
build: migrate from requirements.txt to uv.lock for reproducible builds and faster sync
1 parent 37373dc commit 00ecb0f

4 files changed

Lines changed: 545 additions & 21 deletions

File tree

Dockerfile

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
21
FROM python:3.11-slim as builder
32

4-
RUN pip install uv
3+
# Install uv
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
55

66
# Configure UV for container environment
7-
ENV UV_SYSTEM_PYTHON=1 UV_COMPILE_BYTECODE=1
8-
7+
ENV UV_COMPILE_BYTECODE=1 \
8+
UV_LINK_MODE=copy
99

1010
WORKDIR /app
1111

12+
# Copy dependency files
13+
COPY pyproject.toml uv.lock ./
1214

13-
COPY requirements.txt .
14-
15-
16-
RUN uv pip install -r requirements.txt
17-
15+
# Install dependencies (creates an isolated virtual environment at /app/.venv)
16+
RUN uv sync --frozen --no-install-project --no-dev
1817

1918
FROM gcr.io/distroless/python3-debian12
2019

2120
WORKDIR /app
2221

23-
COPY --from=builder /usr/local/lib/python3.11/site-packages /app/packages
24-
22+
# Copy the dependencies from the builder's virtual environment
23+
COPY --from=builder /app/.venv/lib/python3.11/site-packages /app/packages
2524

2625
COPY . .
2726

28-
ENV PYTHONPATH /app/packages
29-
27+
ENV PYTHONPATH=/app/packages
3028

3129
ENTRYPOINT ["python"]
3230
CMD ["main.py"]

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[project]
2+
name = "dcubabot"
3+
version = "0.1.0"
4+
description = "Bot de Telegram del DC-UBA"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"beautifulsoup4",
9+
"icalevents",
10+
"psycopg2-binary",
11+
"python-telegram-bot[webhooks]==22.0",
12+
"pytz",
13+
"requests",
14+
"sqlalchemy",
15+
"sqlalchemy-cockroachdb",
16+
]

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)