Skip to content

Commit 4d94380

Browse files
author
Adriano Sanges
committed
Refactor Dockerfile for improved build process
- Update base image to python:3.11-slim-bookworm - Simplify installation by copying UV directly from GitHub Container Registry - Remove unnecessary steps related to requirements and project file copying - Set entry point to use UV for running the application
1 parent 3124c31 commit 4d94380

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

Dockerfile

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,16 @@
1-
FROM python:3.11-slim
1+
FROM python:3.11-slim-bookworm
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
23

4+
ADD . /app
35
WORKDIR /app
46

5-
# Install UV
6-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
7+
RUN apt-get update && apt-get install -y \
8+
build-essential \
9+
curl \
10+
software-properties-common \
11+
git \
12+
&& rm -rf /var/lib/apt/lists/*
713

8-
# Copy requirements files
9-
COPY real-estate-etl/requirements.txt .
10-
COPY real-estate-sqlmesh/requirements.txt ./sqlmesh-requirements.txt
14+
RUN uv sync --frozen
1115

12-
# Install dependencies
13-
RUN /root/.local/bin/uv pip install -r requirements.txt
14-
RUN /root/.local/bin/uv pip install -r sqlmesh-requirements.txt
15-
16-
# Copy project files
17-
COPY real-estate-etl/ ./real-estate-etl/
18-
COPY real-estate-sqlmesh/ ./real-estate-sqlmesh/
19-
20-
# Set build arguments
21-
ARG WAREHOUSE_NAME
22-
ARG MOTHERDUCK_TOKEN
23-
ARG SCRAPE_URL
24-
ARG TELEGRAM_BOT_API_KEY
25-
ARG CHAT_ID
26-
ARG CHAT_TAG
27-
28-
# Set environment variables
29-
ENV WAREHOUSE_NAME=$WAREHOUSE_NAME
30-
ENV MOTHERDUCK_TOKEN=$MOTHERDUCK_TOKEN
31-
ENV SCRAPE_URL=$SCRAPE_URL
32-
ENV TELEGRAM_BOT_API_KEY=$TELEGRAM_BOT_API_KEY
33-
ENV CHAT_ID=$CHAT_ID
34-
ENV CHAT_TAG=$CHAT_TAG
35-
36-
# Run the script
37-
CMD ["python", "real-estate-etl/scan_properties.py"]
16+
ENTRYPOINT ["uv","run"]

0 commit comments

Comments
 (0)