FROM python:3.12-slim-bullseye AS builder # Build dummy packages to skip installing them and their dependencies RUN apt-get update \ && apt-get install -y --no-install-recommends equivs \ && equivs-control libgl1-mesa-dri \ && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: libgl1-mesa-dri\nVersion: 99.0.0\nDescription: Dummy package for libgl1-mesa-dri\n' >> libgl1-mesa-dri \ && equivs-build libgl1-mesa-dri \ && mv libgl1-mesa-dri_*.deb /libgl1-mesa-dri.deb \ && equivs-control adwaita-icon-theme \ && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: adwaita-icon-theme\nVersion: 99.0.0\nDescription: Dummy package for adwaita-icon-theme\n' >> adwaita-icon-theme \ && equivs-build adwaita-icon-theme \ && mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb FROM python:3.12-slim-bullseye # Copy dummy packages COPY --from=builder /*.deb / # Install dependencies and create byparr user # You can test Chromium running this command inside the container: # xvfb-run -s "-screen 0 1600x1200x24" chromium --no-sandbox # The error traces is like this: "*** stack smashing detected ***: terminated" # To check the package versions available you can use this command: # apt-cache madison chromium WORKDIR /app # Install dummy packages RUN dpkg -i /libgl1-mesa-dri.deb \ && dpkg -i /adwaita-icon-theme.deb \ # Install dependencies && apt-get update \ && apt-get install -y --no-install-recommends chromium xvfb dumb-init \ procps xauth sudo \ # Remove temporary files and hardware decoding libraries && rm -rf /var/lib/apt/lists/* \ && rm -f /usr/lib/x86_64-linux-gnu/libmfxhw* \ && rm -f /usr/lib/x86_64-linux-gnu/mfx/* \ # Create byparr user && useradd --home-dir /app --shell /bin/sh byparr \ && chown -R byparr:byparr . \ && echo 'byparr ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers # Install Python dependencies COPY requirements.txt fix_nodriver.py novnc.sh . RUN pip install -r requirements.txt \ # Remove temporary files && rm -rf /root/.cache \ && PYENV_PATH=/usr/local/lib/python3.12 python fix_nodriver.py ENV INSTALL_NOVNC=false DISPLAY=:1.0 RUN ./novnc.sh USER byparr COPY src . EXPOSE 8191 # dumb-init avoids zombie chromium processes ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/bin/sh", "-c", "/usr/local/share/desktop-init.sh && python -u /app/main.py"] # Local build # docker build -t ngosang/byparr:3.3.21 . # docker run -p 8191:8191 ngosang/byparr:3.3.21 # Multi-arch build # docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # docker buildx create --use # docker buildx build -t ngosang/byparr:3.3.21 --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 . # add --push to publish in DockerHub # Test multi-arch build # docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # docker buildx create --use # docker buildx build -t ngosang/byparr:3.3.21 --platform linux/arm/v7 --load . # docker run -p 8191:8191 --platform linux/arm/v7 ngosang/byparr:3.3.21