Skip to content

Commit 22a50fb

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

File tree

21 files changed

+188
-211
lines changed

21 files changed

+188
-211
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- build-test
4646
if: (contains(toJson(github.event.commits), '[deploy]') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')) && !failure() && !cancelled()
4747
name: Deploy and Release
48-
runs-on: ubuntu-latest
48+
runs-on: blacksmith-8vcpu-ubuntu-2204
4949
permissions: write-all
5050
steps:
5151
- name: Free Disk Space (Ubuntu)
@@ -83,11 +83,10 @@ jobs:
8383
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
8484
- name: Sets prerelease to false by default
8585
run: echo "PRERELEASE=false" >> $GITHUB_ENV
86-
- name: Build base image to get Grid version
87-
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base
8886
- name: Get Grid version
89-
# sed used to remove last comma of Selenium version output
90-
run: echo "GRID_VERSION=$(docker run --rm ${NAME}/base:local-${BUILD_DATE} java -jar /opt/selenium/selenium-server.jar hub --version | awk '{print $3}' | sed 's/\(.*\),/\1 /')" | awk '{$1=$1;print}' >> $GITHUB_ENV
87+
run: |
88+
echo ${BASE_VERSION}
89+
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
9190
- name: Is it a prerelease?
9291
run: echo "GRID_VERSION=${GRID_VERSION}-prerelease" >> $GITHUB_ENV && echo "PRERELEASE=true" >> $GITHUB_ENV
9392
if: contains(toJson(github.event.commits), '[prerelease]') == true
@@ -121,7 +120,7 @@ jobs:
121120
if: github.event.inputs.skip-build-push-image != 'true'
122121
uses: nick-invision/retry@master
123122
with:
124-
timeout_minutes: 90
123+
timeout_minutes: 300
125124
max_attempts: 3
126125
retry_wait_seconds: 60
127126
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build

.github/workflows/docker-test.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,11 @@ 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: |
135135
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
136-
- name: Pre-build to reduce logs in test phase
137-
uses: nick-invision/retry@master
138-
if: matrix.build-all != true
139-
with:
140-
timeout_minutes: 30
141-
max_attempts: 3
142-
retry_wait_seconds: 60
143-
command: |
144-
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make hub
145-
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chrome
146-
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make firefox
147-
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make edge
148136
- name: Set test parameters
149137
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
150138
run: |
@@ -158,7 +146,7 @@ jobs:
158146
- name: Run Docker Compose to ${{ matrix.test-strategy }}
159147
uses: nick-invision/retry@master
160148
with:
161-
timeout_minutes: 40
149+
timeout_minutes: 120
162150
max_attempts: 2
163151
retry_wait_seconds: 60
164152
command: |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
- name: Build Docker images
155155
uses: nick-invision/retry@master
156156
with:
157-
timeout_minutes: 12
157+
timeout_minutes: 60
158158
max_attempts: 3
159159
retry_wait_seconds: 60
160160
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build

.github/workflows/nightly.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- build-test
2424
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && !failure() && !cancelled()
2525
name: Deploy and Release Nightly
26-
runs-on: ubuntu-latest
26+
runs-on: blacksmith-8vcpu-ubuntu-2204
2727
permissions: write-all
2828
steps:
2929
- name: Free Disk Space (Ubuntu)
@@ -63,16 +63,13 @@ jobs:
6363
env:
6464
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
6565
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
66-
- name: Build base image to get Grid version
67-
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base
6866
- name: Get Grid version
69-
# sed used to remove last comma of Selenium version output
7067
run: |
71-
echo "GRID_VERSION=$(docker run --rm ${NAME}/base:local-${BUILD_DATE} java -jar /opt/selenium/selenium-server.jar hub --version | awk '{print $3}' | sed 's/\(.*\),/\1 /')" | awk '{$1=$1;print}' >> $GITHUB_ENV
68+
echo ${BASE_VERSION}
69+
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
7270
- name: Display Grid version and set Base version
7371
run: |
7472
echo ${GRID_VERSION}
75-
echo "BASE_VERSION=$(echo ${GRID_VERSION})" >> $GITHUB_ENV
7673
echo "BASE_RELEASE=nightly" >> $GITHUB_ENV
7774
- name: Update tag nightly
7875
uses: richardsimko/[email protected]
@@ -83,7 +80,7 @@ jobs:
8380
- name: Build images
8481
uses: nick-invision/retry@master
8582
with:
86-
timeout_minutes: 90
83+
timeout_minutes: 300
8784
max_attempts: 3
8885
retry_wait_seconds: 60
8986
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+
openjdk-${JRE_VERSION}-jre-headless
65+
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ BUILD_ARGS := $(BUILD_ARGS) --progress plain
1717
MAJOR := $(word 1,$(subst ., ,$(TAG_VERSION)))
1818
MINOR := $(word 2,$(subst ., ,$(TAG_VERSION)))
1919
MAJOR_MINOR_PATCH := $(word 1,$(subst -, ,$(TAG_VERSION)))
20+
FFMPEG_VERSION := $(or $(FFMPEG_VERSION),$(FFMPEG_VERSION),7.1)
2021
FFMPEG_TAG_PREV_VERSION := $(or $(FFMPEG_TAG_PREV_VERSION),$(FFMPEG_TAG_PREV_VERSION),ffmpeg-7.1)
2122
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-7.1)
2223
FFMPEG_BASED_NAME := $(or $(FFMPEG_BASED_NAME),$(FFMPEG_BASED_NAME),linuxserver)
@@ -244,7 +245,7 @@ standalone_edge_beta: edge_beta
244245
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 .
245246

246247
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) .
248+
cd ./Video && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg VERSION_FFMPEG=$(FFMPEG_VERSION) $(FROM_IMAGE_ARGS) -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .
248249

249250
fetch_grid_scaler_resources:
250251
mkdir -p ./.keda/scalers \
@@ -932,7 +933,7 @@ chart_test_autoscaling_deployment:
932933
./tests/charts/make/chart_test.sh DeploymentAutoscaling
933934

934935
chart_test_autoscaling_job_https:
935-
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_BASIC_AUTH=true SELENIUM_GRID_MONITORING=false SCALING_STRATEGY=accurate \
936+
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_BASIC_AUTH=true SELENIUM_GRID_MONITORING=false \
936937
SECURE_CONNECTION_SERVER=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 SUB_PATH=/ \
937938
MAX_SESSIONS_FIREFOX=1 MAX_SESSIONS_EDGE=2 MAX_SESSIONS_CHROME=3 TEST_NAME_OVERRIDE=true \
938939
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) EXTERNAL_UPLOADER_CONFIG=true \
@@ -954,7 +955,7 @@ chart_test_autoscaling_job:
954955
./tests/charts/make/chart_test.sh JobAutoscaling
955956

956957
chart_test_autoscaling_playwright_connect_grid:
957-
PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true MATRIX_TESTS=CDPTests SCALING_STRATEGY=accurate \
958+
PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true MATRIX_TESTS=CDPTests \
958959
BASIC_AUTH_USERNAME=docker-selenium BASIC_AUTH_PASSWORD=2NMI4jdBi6k7bENoeUfV25295VvzwAE9chM24a+2VL95uOHozo \
959960
SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=443 \
960961
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \

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-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

NodeChromium/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-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

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-base
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
45
ARG AUTHORS
56
LABEL authors=${AUTHORS}
67

0 commit comments

Comments
 (0)