-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (51 loc) · 1.33 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (51 loc) · 1.33 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM python:3.10-slim
# Install OS dependencies required by Playwright
RUN apt-get update && apt-get install -y \
libnss3 \
libnspr4 \
libdbus-1-3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libatspi2.0-0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
libx11-xcb1 \
# Add other dependencies needed by chromium
libxkbcommon0 \
libdrm2 \
libxcb1 \
libglib2.0-0 \
libgtk-3-0 \
# Install xvfb for headless display
xvfb \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright browsers
RUN playwright install chromium
# Copy the rest of the application code
COPY . .
# Create necessary directories
RUN mkdir -p logs downloads videos/qianniu videos/logistics
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
# Set DISPLAY for xvfb
ENV DISPLAY=:99
# Expose the application port
EXPOSE 3000
# Command to run the application with xvfb
# Start xvfb in the background, then start the FastAPI server
CMD ["sh", "-c", "Xvfb :99 -screen 0 1280x720x24 & python src/main.py"]