-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (32 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
43 lines (32 loc) · 1.16 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
# Dockerfile
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies required for OpenCV, Playwright, and general build tools
RUN apt-get update && apt-get install -y \
build-essential \
libgl1 \
libglib2.0-0 \
curl \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Upgrade pip
RUN pip install --upgrade pip
# Install PyTorch CPU version explicitly to reduce image size (unless you have a GPU server)
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Install remaining Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright browsers and system dependencies
RUN playwright install --with-deps
# Copy the rest of the application code
COPY . .
# Run the setup script to pre-download NLTK data and AI models into the image
# This prevents downloading them every time the container starts
RUN python scripts/setup_env.py
# Default command (can be overridden in docker-compose)
CMD ["python", "webapp.py"]