AdarshJi commited on
Commit
5cb2bb5
·
verified ·
1 Parent(s): 560edb5

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +67 -0
Dockerfile ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for Perchance Image-Generation Server (for Hugging Face Spaces)
2
+ # Based on Debian-slim + Python. Installs Chromium runtime libs so zendriver
3
+ # can operate in headless mode where allowed.
4
+ FROM python:3.12-slim
5
+
6
+ # runtime env
7
+ ENV PYTHONDONTWRITEBYTECODE=1 \
8
+ PYTHONUNBUFFERED=1 \
9
+ PORT=7860 \
10
+ ZD_HEADLESS=true \
11
+ NO_INITIAL_FETCH=true
12
+
13
+ WORKDIR /app
14
+
15
+ # install system deps (chromium runtime libs + common utils)
16
+ RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ ca-certificates \
18
+ curl \
19
+ gnupg \
20
+ wget \
21
+ unzip \
22
+ fonts-liberation \
23
+ libnss3 \
24
+ libxss1 \
25
+ libasound2 \
26
+ libatk1.0-0 \
27
+ libcups2 \
28
+ libx11-xcb1 \
29
+ libxcomposite1 \
30
+ libxdamage1 \
31
+ libxrandr2 \
32
+ libgbm1 \
33
+ libgtk-3-0 \
34
+ libxshmfence1 \
35
+ procps \
36
+ build-essential \
37
+ && rm -rf /var/lib/apt/lists/*
38
+
39
+ # Install Chromium (Debian's package name may vary across distros).
40
+ # In many slim images the package is "chromium" or "chromium-browser".
41
+ # Try chromium; if your target base differs, change accordingly.
42
+ RUN apt-get update && apt-get install -y --no-install-recommends chromium \
43
+ || true && rm -rf /var/lib/apt/lists/*
44
+
45
+ # Safety: set CHROME_BIN to where Chromium usually is installed
46
+ ENV CHROME_BIN=/usr/bin/chromium
47
+
48
+ # copy requirements first (docker layer caching)
49
+ COPY requirements.txt /app/requirements.txt
50
+
51
+ # upgrade pip and install python deps
52
+ RUN python -m pip install --upgrade pip setuptools wheel \
53
+ && pip --no-cache-dir install -r /app/requirements.txt
54
+
55
+ # copy app sources
56
+ COPY . /app
57
+
58
+ # make start script executable
59
+ COPY start.sh /app/start.sh
60
+ RUN chmod +x /app/start.sh
61
+
62
+ # expose port
63
+ EXPOSE ${PORT}
64
+
65
+ # Start the server.
66
+ # Use sh -c so ${PORT} expansion works in exec form.
67
+ CMD ["sh", "-c", "/app/start.sh"]