Switch to Chromium
This commit is contained in:
parent
e9df645b49
commit
d9fc5df080
8 changed files with 24 additions and 154 deletions
63
Dockerfile
63
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.
|
# Build the membarrier check tool.
|
||||||
|
@ -16,24 +16,20 @@ RUN strip membarrier_check
|
||||||
FROM jlesage/baseimage-gui:alpine-3.21-v4.7.1
|
FROM jlesage/baseimage-gui:alpine-3.21-v4.7.1
|
||||||
|
|
||||||
# Docker image version is provided via build arg.
|
# Docker image version is provided via build arg.
|
||||||
ARG DOCKER_IMAGE_VERSION=
|
ARG DOCKER_IMAGE_VERSION=v0.1.0
|
||||||
|
|
||||||
# Define software versions.
|
# Define software versions.
|
||||||
ARG FIREFOX_VERSION=136.0.4-r0
|
ARG CHROMIUM_VERSION=136.0.7103.113-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
|
|
||||||
|
|
||||||
# Define working directory.
|
# Define working directory.
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
# Install Firefox.
|
# Install Chromium.
|
||||||
RUN \
|
RUN \
|
||||||
# add-pkg --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
|
# add-pkg --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
|
||||||
# --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
# --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||||
# --upgrade firefox=${FIREFOX_VERSION}
|
# --upgrade chromium=${CHROMIUM_VERSION}
|
||||||
add-pkg firefox=${FIREFOX_VERSION}
|
add-pkg chromium=${CHROMIUM_VERSION}
|
||||||
|
|
||||||
# Install extra packages.
|
# Install extra packages.
|
||||||
RUN \
|
RUN \
|
||||||
|
@ -47,34 +43,7 @@ RUN \
|
||||||
# A font is needed.
|
# A font is needed.
|
||||||
font-dejavu \
|
font-dejavu \
|
||||||
# The following package is used to send key presses to the X process.
|
# The following package is used to send key presses to the X process.
|
||||||
xdotool \
|
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"
|
|
||||||
|
|
||||||
# Add files.
|
# Add files.
|
||||||
COPY rootfs/ /
|
COPY rootfs/ /
|
||||||
|
@ -82,21 +51,15 @@ COPY --from=membarrier /tmp/membarrier_check /usr/bin/
|
||||||
|
|
||||||
# Set internal environment variables.
|
# Set internal environment variables.
|
||||||
RUN \
|
RUN \
|
||||||
set-cont-env APP_NAME "Firefox" && \
|
set-cont-env APP_NAME "Chromium" && \
|
||||||
set-cont-env APP_VERSION "$FIREFOX_VERSION" && \
|
set-cont-env APP_VERSION "$CHROMIUM_VERSION" && \
|
||||||
set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \
|
set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \
|
||||||
true
|
true
|
||||||
|
|
||||||
# Set public environment variables.
|
|
||||||
ENV \
|
|
||||||
FF_OPEN_URL= \
|
|
||||||
FF_KIOSK=0 \
|
|
||||||
FF_CUSTOM_ARGS=
|
|
||||||
|
|
||||||
# Metadata.
|
# Metadata.
|
||||||
LABEL \
|
LABEL \
|
||||||
org.label-schema.name="firefox" \
|
org.label-schema.name="chromium" \
|
||||||
org.label-schema.description="Docker container for Firefox" \
|
org.label-schema.description="Docker container for Chromium" \
|
||||||
org.label-schema.version="${DOCKER_IMAGE_VERSION:-unknown}" \
|
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"
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
|
@ -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
|
|
|
@ -5,8 +5,7 @@ set -u # Treat unset variables as an error.
|
||||||
|
|
||||||
# Make sure some directories are created.
|
# Make sure some directories are created.
|
||||||
mkdir -p /config/downloads
|
mkdir -p /config/downloads
|
||||||
mkdir -p /config/log/firefox
|
mkdir -p /config/log/chromium
|
||||||
mkdir -p /config/profile
|
|
||||||
|
|
||||||
# Generate machine id.
|
# Generate machine id.
|
||||||
if [ ! -f /config/machine-id ]; then
|
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
|
cat /proc/sys/kernel/random/uuid | tr -d '-' > /config/machine-id
|
||||||
fi
|
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.
|
# 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
|
do
|
||||||
touch "$LOG_FILE"
|
touch "$LOG_FILE"
|
||||||
|
|
|
@ -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
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Firefox doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
# Chromium doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
||||||
# opened tabs may not be saved. Instead, terminate Firefox by sending the
|
# opened tabs may not be saved. Instead, terminate Chromium by sending the
|
||||||
# CTRL+q key presses.
|
# CTRL+q key presses.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ xdotool key "ctrl+q"
|
||||||
|
|
||||||
for i in $(seq 1 10)
|
for i in $(seq 1 10)
|
||||||
do
|
do
|
||||||
if ! ps | grep "/usr/lib/firefox/firefox" | grep -q -v grep
|
if ! ps | grep "/usr/lib/chromium/chromium" | grep -q -v grep
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,25 +3,8 @@
|
||||||
set -e # Exit immediately if a command exits with a non-zero status.
|
set -e # Exit immediately if a command exits with a non-zero status.
|
||||||
set -u # Treat unset variables as an error.
|
set -u # Treat unset variables as an error.
|
||||||
|
|
||||||
# Set location of profile.
|
# Always make browser take up full screen
|
||||||
echo "--profile"
|
echo "--start-maximized"
|
||||||
echo "/config/profile"
|
|
||||||
|
|
||||||
# Make sure we don't get ask to be the default browser.
|
# Disable sandboxing, which isn't supported in containers
|
||||||
echo "--setDefaultBrowser"
|
echo "--no-sandbox"
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ for PID in "$PIDS"; do
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
/usr/bin/firefox --version
|
/usr/bin/chromium --version
|
||||||
exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log
|
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
|
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||||
|
|
|
@ -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);
|
|
Loading…
Add table
Add a link
Reference in a new issue