From 4224f748b78fcd6fceab1e70a02eedae3063a86c Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sun, 29 Mar 2020 21:25:53 +0200 Subject: [PATCH] Update firefox image - Add example usage in such a way that `DIR=firefox make run` work - Use bullseye (stable) instead of sid (unstable) as base-image - Make it possible to change this at buildtime with the buildarg DEBVERSION - Take firefox from bionic (newest LTS) instead of xenial (older LTS) - Make it possible to change this at buildtime with the buildarg UBUVERSION - Use UTF-8 as default LANG - Run it as user "user" with homedir "/home/user" - Make it possible to change this at buildtime with the buildargs USER and HOME --- firefox/Dockerfile | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/firefox/Dockerfile b/firefox/Dockerfile index 8cc57c5a4..7477e784f 100644 --- a/firefox/Dockerfile +++ b/firefox/Dockerfile @@ -1,12 +1,24 @@ -FROM debian:sid-slim +#Run firefox in a container: +# +#docker run -d --rm --net host \ +# --device /dev/snd --device /dev/dri -v /dev/shm:/dev/shm \ +# -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY \ +# -v $HOME/Downloads:/home/user/Downloads \ +# -v $HOME/.mozilla:/home/user/.mozilla \ +# --name firefox jess/firefox +# + +ARG DEBVERSION=bullseye-slim +FROM debian:$DEBVERSION LABEL maintainer "Jessie Frazelle " +ARG UBUVERSION=bionic RUN apt-get update && apt-get install -y \ dirmngr \ gnupg \ --no-install-recommends \ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0AB215679C571D1C8325275B9BDB3D89CE49EC21 \ - && echo "deb http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu xenial main" >> /etc/apt/sources.list.d/firefox.list \ + && echo "deb http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu ${UBUVERSION} main" >> /etc/apt/sources.list.d/firefox.list \ && apt-get update && apt-get install -y \ apulse \ ca-certificates \ @@ -23,7 +35,7 @@ RUN apt-get update && apt-get install -y \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* -ENV LANG en-US +ENV LANG C.UTF-8 COPY local.conf /etc/fonts/local.conf @@ -31,4 +43,10 @@ RUN echo 'pref("browser.tabs.remote.autostart", false);' >> /etc/firefox/syspref COPY entrypoint.sh /usr/bin/startfirefox +ARG USER=user +ARG HOME=/home/${USER} +RUN useradd --create-home --home-dir $HOME $USER && chown -R ${USER}:${USER} $HOME +WORKDIR $HOME +USER $USER + ENTRYPOINT [ "startfirefox" ]