File size: 4,571 Bytes
9e7ee1a 8b818ce 4a0b553 986b20b 9e7ee1a b1044a6 9e7ee1a 4a0b553 690e986 e1d4d36 d34db81 9e7ee1a d0729b2 a95bab8 9e7ee1a 7273978 9e7ee1a 4f33572 9e7ee1a 4f33572 986b20b 4f33572 6e48cb5 4f33572 9e7ee1a 8b818ce 9e7ee1a d34db81 8b818ce 9e7ee1a 8b818ce b1044a6 9e7ee1a b1044a6 8b818ce 9e7ee1a 8b818ce 9e7ee1a 4a0b553 690e986 9e7ee1a 4f33572 9e7ee1a 8b818ce 9e7ee1a | 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | # Switched to bookworm for newer system libraries and GCC 12+
FROM python:3.11-slim-bookworm
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
# Ensure CMake finds the libraries we install in /usr
CMAKE_PREFIX_PATH=/usr
# 1. Install System Dependencies & Build Tools
# Added: libgl1-mesa-glx/dri (Fixes Chrome black screen), libcurl4-openssl-dev (for WebRTC)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
cmake \
git \
libswscale-dev \
libavutil-dev \
python3-dev \
xvfb \
x11-utils \
x11-xserver-utils \
xdotool \
matchbox-window-manager \
# X11 Development Headers
libx11-dev \
libxtst-dev \
libxext-dev \
libxrandr-dev \
libxfixes-dev \
libxcomposite-dev \
libxcursor-dev \
libxdamage-dev \
libxi-dev \
libxss-dev \
# Media & Encoding
libssl-dev \
libx264-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libswresample-dev \
libvpx-dev \
libopus-dev \
# Software Rendering (Crucial for Xvfb/Chrome)
libgl1-mesa-dri \
libgl1-mesa-glx \
mesa-utils \
libgbm1 \
libasound2 \
# Chrome/Electron Deps
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libpangocairo-1.0-0 \
libgtk-3-0 \
fonts-liberation \
fonts-noto-color-emoji \
# Utilities
wget \
curl \
gnupg \
procps \
ca-certificates \
unzip \
&& rm -rf /var/lib/apt/lists/*
# 2. Build and Install LibDataChannel (C++ WebRTC Library)
# We explicitely use CMAKE_INSTALL_PREFIX=/usr to ensure pkg-config finds it later
RUN cd /tmp && \
git clone https://github.com/paullouisageneau/libdatachannel.git && \
cd libdatachannel && \
git submodule update --init --recursive && \
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_GNUTLS=0 \
-DUSE_NICE=0 \
-DNO_WEBSOCKET=OFF \
-DNO_EXAMPLES=ON \
-DNO_TESTS=ON && \
cmake --build build -j$(nproc) && \
cmake --install build && \
ldconfig && \
cd .. && rm -rf libdatachannel
# 3. Install Chrome
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get update && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb && \
rm -rf /var/lib/apt/lists/*
# 4. Configure Chrome Wrapper (Sandbox disabled for Docker)
RUN mv /usr/bin/google-chrome /usr/bin/google-chrome-orig && \
echo '#!/bin/bash\n/usr/bin/google-chrome-orig --no-sandbox --start-maximized --no-first-run --no-default-browser-check --disable-gpu-compositing --disable-dev-shm-usage "$@"' > /usr/bin/google-chrome && \
chmod +x /usr/bin/google-chrome
RUN update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/google-chrome 9999
# 5. Install Antigravity (With Robust GPG Key Handling)
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg -o /tmp/antigravity-key.gpg && \
gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg /tmp/antigravity-key.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev/ antigravity-debian main" | tee /etc/apt/sources.list.d/antigravity.list && \
apt-get update && \
apt-get install -y antigravity && \
rm -rf /var/lib/apt/lists/* /tmp/antigravity-key.gpg
# 6. User Setup
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
WORKDIR $HOME/app
# 7. Install Python Dependencies
# We install aiohttp explicitly first because app.py needs it to compile
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir aiohttp psutil && \
pip install --no-cache-dir -r requirements.txt
# 8. Copy App and Compile Extension
COPY --chown=user:user app.py .
# Force compilation of the C++ extension during build time.
# DISPLAY="" prevents X11 connection attempts during build.
RUN DISPLAY="" python -c "import app; print('C++ Extension Compiled Successfully')"
# 9. Environment Configuration
ENV DISPLAY=:99 \
RESOLUTION=1280x720 \
BROWSER=/usr/bin/google-chrome
EXPOSE 7860
CMD ["python", "app.py"]
|