Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. FROM docker.io/debian:12.2-slim
  2. # manually installing libgl1 to fix some browser crashes
  3. # and to reduce ubiquitous "Aw, Snap!" errors ("Error code: 6"):
  4. # > [[...]:angle_platform_impl.cc(43)] Display.cpp:833 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: [...]
  5. # > [[...]:gl_surface_egl.cc(773)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: [...]
  6. # > [[...]:gl_surface_egl.cc(1322)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
  7. # > [[...]:gl_initializer_linux_x11.cc(160)] GLSurfaceEGL::InitializeOneOff failed.
  8. # > [[...]:viz_main_impl.cc(150)] Exiting GPU process due to errors during initialization
  9. # https://brave.com/linux/#release-channel-installation
  10. RUN apt-get update \
  11. && apt-get install --yes --no-install-recommends \
  12. ca-certificates \
  13. fonts-tlwg-loma-ttf \
  14. gnupg \
  15. libgl1 \
  16. && apt-key adv --keyserver keyserver.ubuntu.com \
  17. --recv-keys D8BAD4DE7EE17AF52A834B2D0BB75829C2D4E821 \
  18. && rm -rf /var/lib/apt/lists/* \
  19. && echo "deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" \
  20. > /etc/apt/sources.list.d/brave-browser-release.list \
  21. && useradd --create-home browser
  22. ARG BRAVE_BROWSER_PACKAGE_VERSION=1.52.122
  23. RUN apt-get update \
  24. && apt-cache policy brave-browser \
  25. && apt-get install --yes --no-install-recommends \
  26. brave-browser=$BRAVE_BROWSER_PACKAGE_VERSION \
  27. && rm -rf /var/lib/apt/lists/* \
  28. && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
  29. && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \;
  30. USER browser
  31. VOLUME /home/browser
  32. # --disable-dev-shm-usage to fix some "Aw, Snap!" errors and video playback,
  33. # apparently by resolving:
  34. # > ERROR:broker_posix.cc(46)] Received unexpected number of handles
  35. # https://github.com/WPO-Foundation/wptagent/issues/327#issuecomment-614086842
  36. CMD ["brave-browser", "--no-sandbox"]
  37. # mounts tmpfs at /tmp implicitly
  38. LABEL podman-run-x11="podman run --name brave_browser --rm --init -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v brave_browser_home:/home/browser --shm-size 1GB --read-only --cap-drop ALL --security-opt no-new-privileges \${IMAGE}"
  39. # https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
  40. ARG REVISION=
  41. LABEL org.opencontainers.image.title="brave browser" \
  42. org.opencontainers.image.source="https://github.com/fphammerle/docker-brave-browser" \
  43. org.opencontainers.image.revision="$REVISION"