-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 906 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 1. Base Image: Use a slim Python image that matches your local environment
FROM python:3.10-slim
# 2. Environment Variables: For better logging and organization
ENV PYTHONUNBUFFERED=1
ENV APP_HOME=/app
WORKDIR $APP_HOME
# 3. Install uv: The project's package manager
RUN pip install uv
# 4. Copy dependency files first for caching
COPY pyproject.toml uv.lock ./
# 5. Install dependencies using uv
RUN uv sync --no-cache
# 6. Copy the rest of the application code
COPY . .
# 7. REMOVED: Do not run scraper during build, as it will be hidden by the volume.
# RUN uv run python main.py
# 8. Expose the port the app runs on
EXPOSE 8080
# 9. Command to run the application
# On start, first run the scraper to populate the volume,
# then start the web server. The worker service will handle subsequent updates.
CMD ["sh", "-c", "uv run python main.py && uv run gunicorn app:app --bind 0.0.0.0:8080"]