Skip to content

Commit c83d6a8

Browse files
committed
Build FFmpeg and optimize video container
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent bf73ae9 commit c83d6a8

File tree

23 files changed

+208
-201
lines changed

23 files changed

+208
-201
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
if: github.event.inputs.skip-build-push-image != 'true'
122122
uses: nick-invision/retry@master
123123
with:
124-
timeout_minutes: 90
124+
timeout_minutes: 120
125125
max_attempts: 3
126126
retry_wait_seconds: 60
127127
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build

.github/workflows/docker-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
uses: nick-invision/retry@master
129129
if: matrix.build-all == true
130130
with:
131-
timeout_minutes: 20
131+
timeout_minutes: 60
132132
max_attempts: 3
133133
retry_wait_seconds: 60
134134
command: |

.github/workflows/helm-chart-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
- name: Build Docker images
148148
uses: nick-invision/retry@master
149149
with:
150-
timeout_minutes: 12
150+
timeout_minutes: 60
151151
max_attempts: 3
152152
retry_wait_seconds: 60
153153
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
- name: Build images
8484
uses: nick-invision/retry@master
8585
with:
86-
timeout_minutes: 90
86+
timeout_minutes: 120
8787
max_attempts: 3
8888
retry_wait_seconds: 60
8989
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build

Base/Dockerfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ ENV DEBIAN_FRONTEND=noninteractive \
3333
SEL_GID=${GID} \
3434
HOME=${HOME} \
3535
TZ=${TZ} \
36-
SEL_DOWNLOAD_DIR=${HOME}/Downloads
36+
SEL_DOWNLOAD_DIR=${HOME}/Downloads \
37+
VIDEO_FOLDER="/videos"
3738

3839
#========================
3940
# Miscellaneous packages
4041
# Includes minimal runtime used for executing non GUI Java programs
4142
#========================
42-
RUN --mount=type=secret,id=SEL_PASSWD \
43-
if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
43+
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
4444
echo "deb http://archive.ubuntu.com/ubuntu noble main universe\n" > /etc/apt/sources.list \
4545
&& echo "deb http://archive.ubuntu.com/ubuntu noble-updates main universe\n" >> /etc/apt/sources.list \
4646
&& echo "deb http://security.ubuntu.com/ubuntu noble-security main universe\n" >> /etc/apt/sources.list ; \
@@ -61,8 +61,10 @@ RUN --mount=type=secret,id=SEL_PASSWD \
6161
gnupg2 \
6262
libnss3-tools \
6363
python3-pip \
64-
openjdk-${JRE_VERSION}-jre-headless \
65-
&& if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
64+
python3-psutil \
65+
openjdk-${JRE_VERSION}-jre-headless
66+
RUN --mount=type=secret,id=SEL_PASSWD \
67+
if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
6668
export ARCH=armhf ; \
6769
else \
6870
export ARCH=$(dpkg --print-architecture) ; \
@@ -93,18 +95,18 @@ RUN --mount=type=secret,id=SEL_PASSWD \
9395
# Selenium & relaxing permissions for OpenShift and other non-sudo environments
9496
#==========
9597
&& mkdir -p /opt/selenium /opt/selenium/assets /opt/selenium/secrets /var/run/supervisor /var/log/supervisor ${SEL_DOWNLOAD_DIR} \
96-
${HOME}/.mozilla ${HOME}/.vnc ${HOME}/.pki/nssdb \
98+
${HOME}/.mozilla ${HOME}/.vnc ${HOME}/.pki/nssdb ${VIDEO_FOLDER} \
9799
# NSSDB initialization with an empty password
98100
&& certutil -d sql:${HOME}/.pki/nssdb -N --empty-password \
99101
&& touch /opt/selenium/config.toml \
100-
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
101-
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
102+
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
103+
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
102104
&& wget --no-verbose https://github.com/${AUTHORS}/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
103105
-O /opt/selenium/selenium-server.jar \
104-
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
105-
&& chmod -R g=u /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
106-
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
107-
&& setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
106+
&& chgrp -R 0 /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
107+
&& chmod -R g=u /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
108+
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
109+
&& setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
108110
#=====
109111
# Download observability related OpenTelemetry jars and make them available in a separate directory
110112
# so that the container can skip downloading them everytime it comes up

Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ prepare_resources:
114114
rm -rf ./Base/configs/node && mkdir -p ./Base/configs/node && cp -r ./charts/selenium-grid/configs/node ./Base/configs
115115

116116
gen_certs:
117-
rm -rf ./Base/certs && cp -r ./charts/selenium-grid/certs ./Base
118-
./Base/certs/gen-cert-helper.sh -d ./Base/certs
117+
if [ ! -d ./Base/certs ]; then \
118+
rm -rf ./Base/certs && cp -r ./charts/selenium-grid/certs ./Base \
119+
&& ./Base/certs/gen-cert-helper.sh -d ./Base/certs; \
120+
fi
119121

120122
base: prepare_resources gen_certs
121123
cd ./Base && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION) --build-arg RELEASE=$(BASE_RELEASE) --build-arg AUTHORS=$(AUTHORS) \
@@ -145,7 +147,14 @@ event_bus: base
145147
node_base: base
146148
cd ./NodeBase && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --secret id=SEL_PASSWD -t $(NAME)/node-base:$(TAG_VERSION) .
147149

148-
chrome: node_base
150+
recorder_base: base
151+
cd ./RecorderBase && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/recorder-base:$(TAG_VERSION) .
152+
153+
node_video_base: recorder_base
154+
cd ./NodeBase && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --secret id=SEL_PASSWD \
155+
--build-arg BASE=recorder-base -t $(NAME)/node-video-base:$(TAG_VERSION) .
156+
157+
chrome: node_video_base
149158
case "$(PLATFORMS)" in \
150159
*linux/amd64*) \
151160
echo "Google Chrome is only supported on linux/amd64" \
@@ -162,10 +171,10 @@ chrome_dev:
162171
chrome_beta:
163172
cd ./NodeChrome && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg CHROME_VERSION=google-chrome-beta -t $(NAME)/node-chrome:beta .
164173

165-
chromium: node_base
174+
chromium: node_video_base
166175
cd ./NodeChromium && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg CHROMIUM_VERSION=$(CHROMIUM_VERSION) -t $(NAME)/node-chromium:$(TAG_VERSION) .
167176

168-
edge: node_base
177+
edge: node_video_base
169178
case "$(PLATFORMS)" in \
170179
*linux/amd64*) \
171180
echo "Microsoft Edge is only supported on linux/amd64" \
@@ -182,7 +191,7 @@ edge_dev:
182191
edge_beta:
183192
cd ./NodeEdge && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg EDGE_VERSION=microsoft-edge-beta -t $(NAME)/node-edge:beta .
184193

185-
firefox: node_base
194+
firefox: node_video_base
186195
cd ./NodeFirefox && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-firefox:$(TAG_VERSION) .
187196

188197
firefox_dev:
@@ -244,7 +253,7 @@ standalone_edge_beta: edge_beta
244253
cd ./Standalone && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-edge -t $(NAME)/standalone-edge:beta .
245254

246255
video:
247-
cd ./Video && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg NAMESPACE=$(FFMPEG_BASED_NAME) --build-arg BASED_TAG=$(FFMPEG_BASED_TAG) --secret id=SEL_PASSWD --sbom=true --attest type=provenance,mode=max -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .
256+
cd ./Video && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/video:$(TAG_VERSION) .
248257

249258
fetch_grid_scaler_resources:
250259
mkdir -p ./.keda/scalers \

NodeBase/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG NAMESPACE=selenium
22
ARG VERSION=latest
3-
FROM ${NAMESPACE}/base:${VERSION}
3+
ARG BASE=base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

@@ -66,8 +67,7 @@ ENV LANG_WHICH=${LANG_WHICH} \
6667
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
6768
DBUS_SESSION_BUS_ADDRESS=/dev/null
6869

69-
RUN --mount=type=secret,id=SEL_PASSWD \
70-
apt-get update -qqy \
70+
RUN apt-get update -qqy \
7171
&& apt-get -qqy --no-install-recommends install \
7272
#==============
7373
# Xvfb
@@ -104,11 +104,12 @@ RUN --mount=type=secret,id=SEL_PASSWD \
104104
&& apt-get -qyy autoremove \
105105
&& rm -rf /var/lib/apt/lists/* \
106106
&& apt-get -qyy clean \
107-
&& pip install --no-cache-dir --upgrade --break-system-packages setuptools \
107+
&& pip install --no-cache-dir --upgrade --break-system-packages setuptools
108108
########################################
109109
# noVNC exposes VNC through a web page #
110110
########################################
111-
&& wget -nv -O noVNC.zip \
111+
RUN --mount=type=secret,id=SEL_PASSWD \
112+
wget -nv -O noVNC.zip \
112113
"https://github.com/novnc/noVNC/archive/refs/${NOVNC_SOURCE}/${NOVNC_VERSION}.zip" \
113114
&& unzip -x noVNC.zip \
114115
&& mv noVNC-${NOVNC_VERSION} /opt/bin/noVNC \

NodeChrome/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG NAMESPACE=selenium
22
ARG VERSION=latest
3-
FROM ${NAMESPACE}/node-base:${VERSION}
3+
ARG BASE=node-video-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

NodeChromium/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG NAMESPACE=selenium
22
ARG VERSION=latest
3-
FROM ${NAMESPACE}/node-base:${VERSION}
3+
ARG BASE=node-video-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

@@ -9,7 +10,7 @@ USER root
910
# Install Chromium
1011
ARG CHROMIUM_VERSION="latest"
1112
ARG CHROMIUM_DEB_SITE="http://deb.debian.org/debian"
12-
RUN echo "deb ${CHROMIUM_DEB_SITE}/ sid main" >> /etc/apt/sources.list \
13+
RUN echo "deb ${CHROMIUM_DEB_SITE}/ stable main" >> /etc/apt/sources.list \
1314
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-keyring.gpg \
1415
&& wget -qO- https://ftp-master.debian.org/keys/archive-key-12-security.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-security-keyring.gpg \
1516
&& apt-get update -qqy \

NodeEdge/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG NAMESPACE=selenium
22
ARG VERSION=latest
3-
FROM ${NAMESPACE}/node-base:${VERSION}
3+
ARG BASE=node-video-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

0 commit comments

Comments
 (0)