forked from jlesage/docker-firefox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
137 lines (119 loc) · 4.33 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#
# firefox Dockerfile
#
# https://github.com/jlesage/docker-firefox
#
# Build the membarrier check tool.
FROM alpine:3.12
WORKDIR /tmp
COPY membarrier_check.c .
RUN apk --no-cache add build-base linux-headers
RUN gcc -static -o membarrier_check membarrier_check.c
RUN strip membarrier_check
# Pull base image.
FROM jlesage/baseimage-gui:alpine-3.12-v3.5.6
# Docker image version is provided via build arg.
ARG DOCKER_IMAGE_VERSION=unknown
# Define software versions.
ARG FIREFOX_VERSION=81.0-r0
ARG JSONLZ4_VERSION=c4305b8
ARG LZ4_VERSION=1.8.1.2
#ARG PROFILE_CLEANER_VERSION=2.36
# Define software download URLs.
ARG JSONLZ4_URL=https://github.com/avih/dejsonlz4/archive/${JSONLZ4_VERSION}.tar.gz
ARG LZ4_URL=https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz
#ARG PROFILE_CLEANER_URL=https://github.com/graysky2/profile-cleaner/raw/v${PROFILE_CLEANER_VERSION}/common/profile-cleaner.in
# Define working directory.
WORKDIR /tmp
# Install JSONLZ4 tools.
RUN \
add-pkg --virtual build-dependencies \
curl \
build-base \
&& \
mkdir jsonlz4 && \
mkdir lz4 && \
curl -# -L {$JSONLZ4_URL} | tar xz --strip 1 -C jsonlz4 && \
curl -# -L {$LZ4_URL} | tar xz --strip 1 -C lz4 && \
mv jsonlz4/src/ref_compress/*.c jsonlz4/src/ && \
cp lz4/lib/lz4.* jsonlz4/src/ && \
cd jsonlz4 && \
gcc -static -Wall -o dejsonlz4 src/dejsonlz4.c src/lz4.c && \
gcc -static -Wall -o jsonlz4 src/jsonlz4.c src/lz4.c && \
strip dejsonlz4 jsonlz4 && \
cp -v dejsonlz4 /usr/bin/ && \
cp -v jsonlz4 /usr/bin/ && \
cd .. && \
# Cleanup.
del-pkg build-dependencies && \
rm -rf /tmp/* /tmp/.[!.]*
# Install Firefox.
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}
# Install extra packages.
RUN \
add-pkg \
desktop-file-utils \
adwaita-icon-theme \
ttf-dejavu \
ffmpeg-libs \
# The following package is used to send key presses to the X process.
xdotool
# Set default settings.
RUN \
CFG_FILE="$(ls /usr/lib/firefox/browser/defaults/preferences/firefox-branding.js)" && \
echo '' >> "$CFG_FILE" && \
echo '// Default download directory.' >> "$CFG_FILE" && \
echo 'pref("browser.download.dir", "/config/downloads");' >> "$CFG_FILE" && \
echo 'pref("browser.download.folderList", 2);' >> "$CFG_FILE"
# 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/.[!.]*
# Enable log monitoring.
RUN \
add-pkg yad && \
sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/firefox/error.log|' /etc/logmonitor/logmonitor.conf && \
sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.firefox_shm_check,/tmp/.firefox_membarrier_check|' /etc/logmonitor/logmonitor.conf
# Adjust the openbox config.
RUN \
# Maximize only the main window.
sed-patch 's/<application type="normal">/<application type="normal" title="Mozilla Firefox">/' \
/etc/xdg/openbox/rc.xml && \
# Make sure the main window is always in the background.
sed-patch '/<application type="normal" title="Mozilla Firefox">/a \ <layer>below</layer>' \
/etc/xdg/openbox/rc.xml
# 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.
COPY rootfs/ /
COPY --from=0 /tmp/membarrier_check /usr/bin/
# Set environment variables.
ENV APP_NAME="Firefox"
# Define mountable directories.
VOLUME ["/config"]
# Metadata.
LABEL \
org.label-schema.name="firefox" \
org.label-schema.description="Docker container for Firefox" \
org.label-schema.version="$DOCKER_IMAGE_VERSION" \
org.label-schema.vcs-url="https://github.com/jlesage/docker-firefox" \
org.label-schema.schema-version="1.0"