File size: 1,314 Bytes
680e237 569d399 680e237 5cb2bb5 680e237 5cb2bb5 680e237 5cb2bb5 569d399 5cb2bb5 680e237 | 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 41 42 | # Dockerfile (use alongside perchance_server_with_pyvirtualdisplay.py and entrypoint.sh)
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
TZ=Etc/UTC \
PORT=7860 \
ZD_HEADLESS=false \
USE_VIRTUAL_DISPLAY=true \
NO_INITIAL_FETCH=0
# Install system deps (Xvfb, fonts, curl, unzip, etc.)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv python3-distutils \
ca-certificates wget curl gnupg unzip \
xvfb x11-xkb-utils xauth xdg-utils \
libnss3 libxss1 libasound2 libatk1.0-0 libatk-bridge2.0-0 \
libgtk-3-0 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
fonts-liberation fonts-dejavu-core fonts-noto-cjk \
tzdata \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy project files
COPY server.py /app/server.py
COPY requirements.txt /app/requirements.txt
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Install python deps
RUN python3 -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir -r /app/requirements.txt
EXPOSE ${PORT}
# Health check (simple)
HEALTHCHECK --interval=30s --timeout=3s --start-period=15s --retries=3 \
CMD curl -fsS http://127.0.0.1:${PORT}/health || exit 1
ENTRYPOINT ["/app/entrypoint.sh"] |