Skip to content

Commit

Permalink
Build FFmpeg and optimize video container
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Nov 20, 2024
1 parent 6dc901e commit c93eff5
Show file tree
Hide file tree
Showing 27 changed files with 245 additions and 240 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ jobs:
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
- name: Sets prerelease to false by default
run: echo "PRERELEASE=false" >> $GITHUB_ENV
- name: Build base image to get Grid version
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base
- name: Get Grid version
# sed used to remove last comma of Selenium version output
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
run: |
echo ${BASE_VERSION}
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
- name: Is it a prerelease?
run: echo "GRID_VERSION=${GRID_VERSION}-prerelease" >> $GITHUB_ENV && echo "PRERELEASE=true" >> $GITHUB_ENV
if: contains(toJson(github.event.commits), '[prerelease]') == true
Expand Down Expand Up @@ -121,7 +120,7 @@ jobs:
if: github.event.inputs.skip-build-push-image != 'true'
uses: nick-invision/retry@master
with:
timeout_minutes: 90
timeout_minutes: 240
max_attempts: 3
retry_wait_seconds: 60
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,11 @@ jobs:
uses: nick-invision/retry@master
if: matrix.build-all == true
with:
timeout_minutes: 20
timeout_minutes: 60
max_attempts: 3
retry_wait_seconds: 60
command: |
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Pre-build to reduce logs in test phase
uses: nick-invision/retry@master
if: matrix.build-all != true
with:
timeout_minutes: 30
max_attempts: 3
retry_wait_seconds: 60
command: |
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make hub
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chrome
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make firefox
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make edge
- name: Set test parameters
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
Expand All @@ -158,7 +146,7 @@ jobs:
- name: Run Docker Compose to ${{ matrix.test-strategy }}
uses: nick-invision/retry@master
with:
timeout_minutes: 40
timeout_minutes: 120
max_attempts: 2
retry_wait_seconds: 60
command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Build Docker images
uses: nick-invision/retry@master
with:
timeout_minutes: 12
timeout_minutes: 60
max_attempts: 3
retry_wait_seconds: 60
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,13 @@ jobs:
env:
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
- name: Build base image to get Grid version
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base
- name: Get Grid version
# sed used to remove last comma of Selenium version output
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
echo ${BASE_VERSION}
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
- name: Display Grid version and set Base version
run: |
echo ${GRID_VERSION}
echo "BASE_VERSION=$(echo ${GRID_VERSION})" >> $GITHUB_ENV
echo "BASE_RELEASE=nightly" >> $GITHUB_ENV
- name: Update tag nightly
uses: richardsimko/update-tag@v1.0.11
Expand All @@ -83,7 +80,7 @@ jobs:
- name: Build images
uses: nick-invision/retry@master
with:
timeout_minutes: 90
timeout_minutes: 240
max_attempts: 3
retry_wait_seconds: 60
command: PLATFORMS="${PLATFORMS}" VERSION="${GRID_VERSION}" BUILD_DATE=${BUILD_DATE} make build
Expand Down
25 changes: 14 additions & 11 deletions Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ ENV DEBIAN_FRONTEND=noninteractive \
SEL_GID=${GID} \
HOME=${HOME} \
TZ=${TZ} \
SEL_DOWNLOAD_DIR=${HOME}/Downloads
SEL_DOWNLOAD_DIR=${HOME}/Downloads \
VIDEO_FOLDER="/videos"

#========================
# Miscellaneous packages
# Includes minimal runtime used for executing non GUI Java programs
#========================
RUN --mount=type=secret,id=SEL_PASSWD \
if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
echo "deb http://archive.ubuntu.com/ubuntu noble main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu noble-updates main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu noble-security main universe\n" >> /etc/apt/sources.list ; \
Expand All @@ -61,8 +61,11 @@ RUN --mount=type=secret,id=SEL_PASSWD \
gnupg2 \
libnss3-tools \
python3-pip \
python3-psutil \
openjdk-${JRE_VERSION}-jre-headless \
&& if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
&& pip install --no-cache-dir --upgrade --break-system-packages setuptools
RUN --mount=type=secret,id=SEL_PASSWD \
if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
export ARCH=armhf ; \
else \
export ARCH=$(dpkg --print-architecture) ; \
Expand Down Expand Up @@ -93,18 +96,18 @@ RUN --mount=type=secret,id=SEL_PASSWD \
# Selenium & relaxing permissions for OpenShift and other non-sudo environments
#==========
&& mkdir -p /opt/selenium /opt/selenium/assets /opt/selenium/secrets /var/run/supervisor /var/log/supervisor ${SEL_DOWNLOAD_DIR} \
${HOME}/.mozilla ${HOME}/.vnc ${HOME}/.pki/nssdb \
${HOME}/.mozilla ${HOME}/.vnc ${HOME}/.pki/nssdb ${VIDEO_FOLDER} \
# NSSDB initialization with an empty password
&& certutil -d sql:${HOME}/.pki/nssdb -N --empty-password \
&& touch /opt/selenium/config.toml \
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
&& wget --no-verbose https://github.com/${AUTHORS}/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
-O /opt/selenium/selenium-server.jar \
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& chmod -R g=u /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& chgrp -R 0 /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& chmod -R g=u /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} ${VIDEO_FOLDER} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
#=====
# Download observability related OpenTelemetry jars and make them available in a separate directory
# so that the container can skip downloading them everytime it comes up
Expand Down
Loading

0 comments on commit c93eff5

Please sign in to comment.