Adarshu07 commited on
Commit
9ccb2da
·
verified ·
1 Parent(s): f9c83f8

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile (use alongside perchance_server_with_pyvirtualdisplay.py and entrypoint.sh)
2
+ FROM ubuntu:22.04
3
+
4
+ ENV DEBIAN_FRONTEND=noninteractive \
5
+ PYTHONUNBUFFERED=1 \
6
+ TZ=Etc/UTC \
7
+ PORT=7860 \
8
+ ZD_HEADLESS=false \
9
+ USE_VIRTUAL_DISPLAY=true \
10
+ NO_INITIAL_FETCH=0
11
+
12
+ # Install system deps (Xvfb, fonts, curl, unzip, etc.)
13
+ RUN apt-get update \
14
+ && apt-get install -y --no-install-recommends \
15
+ python3 python3-pip python3-venv python3-distutils \
16
+ ca-certificates wget curl gnupg unzip \
17
+ xvfb x11-xkb-utils xauth xdg-utils \
18
+ libnss3 libxss1 libasound2 libatk1.0-0 libatk-bridge2.0-0 \
19
+ libgtk-3-0 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
20
+ fonts-liberation fonts-dejavu-core fonts-noto-cjk \
21
+ tzdata \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ WORKDIR /app
25
+
26
+ # Copy project files
27
+ COPY server.py /app/server.py
28
+ COPY requirements.txt /app/requirements.txt
29
+ COPY entrypoint.sh /app/entrypoint.sh
30
+ RUN chmod +x /app/entrypoint.sh
31
+
32
+ # Install python deps
33
+ RUN python3 -m pip install --upgrade pip setuptools wheel \
34
+ && pip install --no-cache-dir -r /app/requirements.txt
35
+
36
+ EXPOSE ${PORT}
37
+
38
+ # Health check (simple)
39
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=15s --retries=3 \
40
+ CMD curl -fsS http://127.0.0.1:${PORT}/health || exit 1
41
+
42
+ ENTRYPOINT ["/app/entrypoint.sh"]