Spaces:
Paused
Paused
File size: 1,418 Bytes
3d9dca2 | 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 43 | FROM ubuntu:22.04
# Install Electron runtime dependencies + xvfb for headless display
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates python3 \
xvfb \
libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 \
libatk-bridge2.0-0 libdrm2 libxkbcommon0 libxcomposite1 \
libxdamage1 libxrandr2 libgbm1 libasound2 libxshmfence1 \
libatspi2.0-0 libsecret-1-0 libdbus-1-3 dbus-x11 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Download and install the latest .deb release
RUN wget -q -O /tmp/release.json \
"https://api.github.com/repos/xiaoY233/Chat2API/releases/latest" && \
DL_URL=$(python3 -c "
import json, sys
data = json.load(open('/tmp/release.json'))
for a in data.get('assets', []):
if a['name'].endswith('.deb') and 'amd64' in a['name']:
print(a['browser_download_url'])
sys.exit(0)
") && \
echo "Download: $DL_URL" && \
wget -q -O /tmp/chat2api.deb "$DL_URL" && \
dpkg -i /tmp/chat2api.deb 2>&1 || apt-get install -f -y --no-install-recommends && \
rm /tmp/chat2api.deb /tmp/release.json && \
echo "Chat2API installed: $(/opt/Chat2API/chat2api --version 2>/dev/null || echo 'electron-ready')"
# Pre-configure the proxy to auto-start on boot
RUN mkdir -p /data/.chat2api
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENV HOME=/data
EXPOSE 7860
CMD ["/app/entrypoint.sh"]
|