StarrySkyWorld commited on
Commit
4848c0b
·
verified ·
1 Parent(s): e492141

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +76 -1
Dockerfile CHANGED
@@ -1 +1,76 @@
1
- FROM ghcr.io/sarperavci/cloudflarebypassforscraping:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:rolling
2
+
3
+ # Set environment variables to avoid interactive prompts during build
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Install system dependencies for Chrome and Python packages
7
+ USER root
8
+ RUN apt-get update && apt-get install -y \
9
+ software-properties-common \
10
+ python3-pip \
11
+ python3-venv \
12
+ wget \
13
+ gnupg \
14
+ curl \
15
+ git \
16
+ xvfb \
17
+ libgtk-3-0 \
18
+ libgtk-3-dev \
19
+ libxss1 \
20
+ libxtst6 \
21
+ libxrandr2 \
22
+ libasound2t64 \
23
+ libpangocairo-1.0-0 \
24
+ libatk1.0-0 \
25
+ libcairo-gobject2 \
26
+ libgdk-pixbuf-2.0-0 \
27
+ libdbus-glib-1-2 \
28
+ libxt6 \
29
+ libxcomposite1 \
30
+ libxdamage1 \
31
+ libxext6 \
32
+ libxfixes3 \
33
+ libxrender1 \
34
+ libxi6 \
35
+ fonts-liberation \
36
+ libnss3 \
37
+ lsb-release \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
+ WORKDIR /app
41
+
42
+ # Clone repo since there is no local project
43
+ RUN git clone https://github.com/Starry-Sky-World/CloudflareBypassForScraping /app
44
+
45
+ # Copy requirements.txt and install dependencies
46
+ COPY requirements.txt .
47
+
48
+ # Change ownership of app directory to ubuntu first
49
+ RUN chown -R ubuntu:ubuntu /app
50
+
51
+ # Switch to ubuntu user to create venv and install packages
52
+ USER ubuntu
53
+
54
+ # Create and activate virtual environment as ubuntu user
55
+ RUN python3 -m venv /app/venv
56
+ ENV PATH="/app/venv/bin:$PATH"
57
+
58
+ # Install pip and requirements in virtual environment
59
+ RUN pip install --upgrade pip
60
+ RUN pip install --no-cache-dir -r server_requirements.txt
61
+
62
+ # Fetch Camoufox as ubuntu user
63
+ RUN camoufox fetch
64
+
65
+ # Switch back to root for remaining setup
66
+ USER root
67
+ WORKDIR /app
68
+
69
+ # Fix permissions for playwright_captcha addon directory (needs write access at runtime)
70
+ RUN chmod -R 777 /app/venv/lib/python*/site-packages/playwright_captcha/utils/camoufox_add_init_script/addon/ || true
71
+
72
+ # Switch to ubuntu user for runtime
73
+ USER ubuntu
74
+
75
+ # RUN the application
76
+ CMD ["python3", "server.py"]