-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (29 loc) · 895 Bytes
/
Dockerfile
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
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app user and group with specific UID/GID
RUN groupadd -r scraper && \
useradd -r -g scraper -u 1000 scraper
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project files
COPY . .
# Install Playwright browser
RUN playwright install chromium && \
playwright install-deps
# Make entrypoint executable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Ensure environment file is present and readable
RUN chown scraper:scraper .env && \
chmod 600 .env
# Ensure all files are owned by scraper user
RUN chown -R scraper:scraper /app
# Switch to scraper user
USER scraper
ENTRYPOINT ["/entrypoint.sh"]