CieLZ commited on
Commit
b08fcb7
·
verified ·
1 Parent(s): bea40e2

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Spaces Dockerfile
2
+ FROM python:3.11-slim
3
+
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Install sistem dependencies untuk Playwright
7
+ RUN apt-get update && \
8
+ apt-get install -y --no-install-recommends \
9
+ ca-certificates wget curl gnupg libnss3 libatk1.0-0 libatk-bridge2.0-0 \
10
+ libcups2 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
11
+ libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0 libxshmfence1 \
12
+ libgconf-2-4 libxtst6 libatspi2.0-0 libdrm2 libxkbcommon0 \
13
+ fonts-noto-cjk && \
14
+ rm -rf /var/lib/apt/lists/*
15
+
16
+ # Buat user dengan UID 1000 dulu
17
+ RUN useradd -m -u 1000 user
18
+
19
+ # Install dependencies sebagai root
20
+ COPY requirements.txt /tmp/requirements.txt
21
+ RUN pip install --no-cache-dir -r /tmp/requirements.txt
22
+ RUN playwright install --with-deps chromium
23
+
24
+ # Switch ke user dan setup home directory
25
+ USER user
26
+ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
27
+
28
+ # Working directory di home user (writable)
29
+ WORKDIR $HOME/app
30
+
31
+ # Copy app dengan ownership yang benar
32
+ COPY --chown=user . $HOME/app
33
+
34
+ EXPOSE 7860
35
+
36
+ CMD ["python", "app.py"]