diff --git a/Dockerfile b/Dockerfile index d33dc14..432cfe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # -# firefox Dockerfile +# Chromium Dockerfile # -# https://github.com/jlesage/docker-firefox +# https://git.mmbradley.ca/MichaelBradley/docker-chromium # # Build the membarrier check tool. @@ -16,24 +16,20 @@ RUN strip membarrier_check FROM jlesage/baseimage-gui:alpine-3.21-v4.7.1 # Docker image version is provided via build arg. -ARG DOCKER_IMAGE_VERSION= +ARG DOCKER_IMAGE_VERSION=v0.1.0 # Define software versions. -ARG FIREFOX_VERSION=136.0.4-r0 -#ARG PROFILE_CLEANER_VERSION=2.36 - -# Define software download URLs. -#ARG PROFILE_CLEANER_URL=https://github.com/graysky2/profile-cleaner/raw/v${PROFILE_CLEANER_VERSION}/common/profile-cleaner.in +ARG CHROMIUM_VERSION=136.0.7103.113-r0 # Define working directory. WORKDIR /tmp -# Install Firefox. +# Install Chromium. RUN \ # add-pkg --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \ # --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \ -# --upgrade firefox=${FIREFOX_VERSION} - add-pkg firefox=${FIREFOX_VERSION} +# --upgrade chromium=${CHROMIUM_VERSION} + add-pkg chromium=${CHROMIUM_VERSION} # Install extra packages. RUN \ @@ -47,34 +43,7 @@ RUN \ # A font is needed. font-dejavu \ # The following package is used to send key presses to the X process. - xdotool \ - && \ - # Remove unneeded icons. - find /usr/share/icons/Adwaita -type d -mindepth 1 -maxdepth 1 -not -name 16x16 -not -name scalable -exec rm -rf {} ';' && \ - true - -# Install profile-cleaner. -#RUN \ -# add-pkg --virtual build-dependencies curl && \ -# curl -# -L -o /usr/bin/profile-cleaner {$PROFILE_CLEANER_URL} && \ -# sed-patch 's/@VERSION@/'${PROFILE_CLEANER_VERSION}'/' /usr/bin/profile-cleaner && \ -# chmod +x /usr/bin/profile-cleaner && \ -# add-pkg \ -# bash \ -# file \ -# coreutils \ -# bc \ -# parallel \ -# sqlite \ -# && \ -# # Cleanup. -# del-pkg build-dependencies && \ -# rm -rf /tmp/* /tmp/.[!.]* - -# Generate and install favicons. -RUN \ - APP_ICON_URL=https://github.com/jlesage/docker-templates/raw/master/jlesage/images/firefox-icon.png && \ - install_app_icon.sh "$APP_ICON_URL" + xdotool # Add files. COPY rootfs/ / @@ -82,21 +51,15 @@ COPY --from=membarrier /tmp/membarrier_check /usr/bin/ # Set internal environment variables. RUN \ - set-cont-env APP_NAME "Firefox" && \ - set-cont-env APP_VERSION "$FIREFOX_VERSION" && \ + set-cont-env APP_NAME "Chromium" && \ + set-cont-env APP_VERSION "$CHROMIUM_VERSION" && \ set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \ true -# Set public environment variables. -ENV \ - FF_OPEN_URL= \ - FF_KIOSK=0 \ - FF_CUSTOM_ARGS= - # Metadata. LABEL \ - org.label-schema.name="firefox" \ - org.label-schema.description="Docker container for Firefox" \ + org.label-schema.name="chromium" \ + org.label-schema.description="Docker container for Chromium" \ org.label-schema.version="${DOCKER_IMAGE_VERSION:-unknown}" \ - org.label-schema.vcs-url="https://github.com/jlesage/docker-firefox" \ + org.label-schema.vcs-url="https://git.mmbradley.ca/MichaelBradley/docker-chromium" \ org.label-schema.schema-version="1.0" diff --git a/rootfs/etc/cont-env.d/LIBGL_DRIVERS_PATH b/rootfs/etc/cont-env.d/LIBGL_DRIVERS_PATH deleted file mode 100755 index 192fbcc..0000000 --- a/rootfs/etc/cont-env.d/LIBGL_DRIVERS_PATH +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -# Override what is set by the baseimage and do not set the variable. Needed for -# WebGL support. -exit 100 - -# vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/etc/cont-init.d/55-firefox.sh b/rootfs/etc/cont-init.d/55-chromium.sh similarity index 60% rename from rootfs/etc/cont-init.d/55-firefox.sh rename to rootfs/etc/cont-init.d/55-chromium.sh index 1beb953..4fffa68 100755 --- a/rootfs/etc/cont-init.d/55-firefox.sh +++ b/rootfs/etc/cont-init.d/55-chromium.sh @@ -5,8 +5,7 @@ set -u # Treat unset variables as an error. # Make sure some directories are created. mkdir -p /config/downloads -mkdir -p /config/log/firefox -mkdir -p /config/profile +mkdir -p /config/log/chromium # Generate machine id. if [ ! -f /config/machine-id ]; then @@ -14,14 +13,8 @@ if [ ! -f /config/machine-id ]; then cat /proc/sys/kernel/random/uuid | tr -d '-' > /config/machine-id fi -# Clean/optimize Firefox databases. -#if [ -d /config/.mozilla/firefox ] && [ -d /config/profile ]; then -# [ -f /config/.mozilla/firefox/profiles.ini ] || cp /defaults/profiles.ini /config/.mozilla/firefox/ -# env HOME=/config /usr/bin/profile-cleaner f -#fi - # Initialize log files. -for LOG_FILE in /config/log/firefox/output.log /config/log/firefox/error.log +for LOG_FILE in /config/log/chromium/output.log /config/log/chromium/error.log do touch "$LOG_FILE" diff --git a/rootfs/etc/cont-init.d/56-firefox-set-prefs-from-env.sh b/rootfs/etc/cont-init.d/56-firefox-set-prefs-from-env.sh deleted file mode 100755 index 8da148a..0000000 --- a/rootfs/etc/cont-init.d/56-firefox-set-prefs-from-env.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -set -e - -PREF_FILE="${1:-/config/profile/prefs.js}" - -if [ -z "$PREF_FILE" ]; then - echo "ERROR: Preference file not set." - exit 1 -fi - -mkdir -p "$(dirname "$PREF_FILE")" -[ -f "$PREF_FILE" ] || touch "$PREF_FILE" - -env | grep "^FF_PREF_" | while read -r ENV -do - ENAME="$(echo "$ENV" | cut -d '=' -f1)" - EVAL="$(echo "$ENV" | cut -d '=' -f2-)" - - if [ -z "$EVAL" ]; then - echo "Skipping environment variable '$ENAME': no value set." - continue - fi - - if echo "$EVAL" | grep -q "="; then - PNAME="$(echo "$EVAL" | cut -d '=' -f1)" - PVAL="$(echo "$EVAL" | cut -d '=' -f2-)" - [ -n "$PVAL" ] || PVAL='""' - else - PNAME="$EVAL" - PVAL='""' - fi - - if [ "$PVAL" = "UNSET" ]; then - echo "Removing preference '$PNAME'..." - sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE" - elif grep -q "user_pref(\"$PNAME\"," "$PREF_FILE"; then - echo "Setting preference '$PNAME'..." - sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE" - echo "user_pref(\"$PNAME\", $(echo "$PVAL" | sed 's|\\|\\\\|g'));" >> "$PREF_FILE" - else - echo "Setting new preference '$PNAME'..." - echo "user_pref(\"$PNAME\", $(echo "$PVAL" | sed 's|\\|\\\\|g'));" >> "$PREF_FILE" - fi -done - -# vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/etc/services.d/app/kill b/rootfs/etc/services.d/app/kill index f26848a..8279f34 100755 --- a/rootfs/etc/services.d/app/kill +++ b/rootfs/etc/services.d/app/kill @@ -1,7 +1,7 @@ #!/bin/sh # -# Firefox doesn't gracefully shutdown when receiving SIGTERM. For example, last -# opened tabs may not be saved. Instead, terminate Firefox by sending the +# Chromium doesn't gracefully shutdown when receiving SIGTERM. For example, last +# opened tabs may not be saved. Instead, terminate Chromium by sending the # CTRL+q key presses. # @@ -14,7 +14,7 @@ xdotool key "ctrl+q" for i in $(seq 1 10) do - if ! ps | grep "/usr/lib/firefox/firefox" | grep -q -v grep + if ! ps | grep "/usr/lib/chromium/chromium" | grep -q -v grep then break fi diff --git a/rootfs/etc/services.d/app/params b/rootfs/etc/services.d/app/params index 46c42d9..9e13408 100755 --- a/rootfs/etc/services.d/app/params +++ b/rootfs/etc/services.d/app/params @@ -3,25 +3,8 @@ set -e # Exit immediately if a command exits with a non-zero status. set -u # Treat unset variables as an error. -# Set location of profile. -echo "--profile" -echo "/config/profile" +# Always make browser take up full screen +echo "--start-maximized" -# Make sure we don't get ask to be the default browser. -echo "--setDefaultBrowser" - -# Check if kiosk mode is enabled. -if is-bool-val-true "${FF_KIOSK:-0}"; then - echo "--kiosk" -fi - -# URL to open. -# NOTE: This should be the last argument. -if [ -n "${FF_OPEN_URL:-}" ]; then - echo "$FF_OPEN_URL" -fi - -# Custom arguments. -if [ -n "${FF_CUSTOM_ARGS:-}" ]; then - eval 'for word in '$FF_CUSTOM_ARGS'; do echo "$word"; done' -fi +# Disable sandboxing, which isn't supported in containers +echo "--no-sandbox" diff --git a/rootfs/startapp.sh b/rootfs/startapp.sh index ea263e9..97de430 100755 --- a/rootfs/startapp.sh +++ b/rootfs/startapp.sh @@ -27,7 +27,7 @@ for PID in "$PIDS"; do done set -e -/usr/bin/firefox --version -exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log +/usr/bin/chromium --version +exec /usr/bin/chromium "$@" >> /config/log/chromium/output.log 2>> /config/log/chromium/error.log # vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/usr/lib/firefox/browser/defaults/preferences/firefox-branding.js b/rootfs/usr/lib/firefox/browser/defaults/preferences/firefox-branding.js deleted file mode 100644 index c79e78d..0000000 --- a/rootfs/usr/lib/firefox/browser/defaults/preferences/firefox-branding.js +++ /dev/null @@ -1,12 +0,0 @@ -// Default download directory. -pref("browser.download.dir", "/config/downloads"); -pref("browser.download.folderList", 2); -// Disable the privacy notice page. -pref("toolkit.telemetry.reportingpolicy.firstRun", false); -// Disable some warning messages. -pref("security.sandbox.warn_unprivileged_namespaces", false); -// Prevent closing Firefox when closing the last tab. -pref("browser.tabs.closeWindowWithLastTab", false); -// Disable confirmation before quitting with Ctrl+Q. Needed to allow Firefox -// to quit cleanly when container is shutted down. -pref("browser.warnOnQuitShortcut", false);