Skip to content

Commit 2ccb813

Browse files
committed
[ci] Add workflow to build and deploy FFmpeg tools image
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 521bd33 commit 2ccb813

File tree

3 files changed

+75
-7
lines changed

3 files changed

+75
-7
lines changed

.ffmpeg/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM ubuntu:noble AS builder
22
ARG VERSION_FFMPEG="7.1"
33
ARG VERSION_RCLONE="v1.68.2"
44
ARG VERSION_GO="latest"
5+
ARG GO_CRYPTO_VERSION="v0.31.0"
56

67
USER root
78

@@ -10,10 +11,11 @@ USER root
1011
#======================================
1112
ARG TOOLS_DEPS="autoconf automake cmake libfreetype6 gcc build-essential libtool make nasm pkg-config zlib1g-dev numactl \
1213
libnuma-dev libx11-6 libxcb1 libxcb1-dev yasm git curl jq wget ca-certificates"
14+
ARG FFMPEG_DEPS="libx11-6 libxcb1 libxcb-shm0"
1315

1416
RUN apt-get update -qqy \
1517
&& apt-get upgrade -yq \
16-
&& apt-get -qqy --no-install-recommends install ${TOOLS_DEPS} \
18+
&& apt-get -qqy --no-install-recommends install ${TOOLS_DEPS} ${FFMPEG_DEPS} \
1719
&& apt-get -qyy clean \
1820
&& mkdir -p /usr/local/src
1921

@@ -30,6 +32,10 @@ RUN cd /usr/local/src \
3032
&& git clone https://github.com/rclone/rclone.git \
3133
&& cd rclone \
3234
&& git checkout $VERSION_RCLONE \
35+
# Patch deps version in go.mod to fix CVEs
36+
&& sed -i "s|golang.org/x/crypto v.*|golang.org/x/crypto ${GO_CRYPTO_VERSION}|g" go.mod \
37+
&& go mod tidy \
38+
# Build rclone
3339
&& make \
3440
&& mv ~/go/bin/rclone /usr/local/bin/ \
3541
&& rclone version
@@ -72,10 +78,5 @@ USER root
7278
COPY --from=builder /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
7379
COPY --from=builder /usr/local/bin/rclone /usr/local/bin/rclone
7480

75-
RUN apt-get -qqy update \
76-
&& apt-get -qqy --no-install-recommends install \
77-
libx11-dev libxcb1 libxcb-shm0 \
78-
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
79-
8081
RUN ffmpeg -version \
8182
&& rclone --version

.github/workflows/build-ffmpeg.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and Deploy FFmpeg
2+
3+
on:
4+
push:
5+
paths:
6+
- '.ffmpeg/Dockerfile'
7+
workflow_dispatch:
8+
inputs:
9+
release:
10+
description: 'Deploy a new release'
11+
required: false
12+
type: boolean
13+
default: false
14+
15+
jobs:
16+
deploy:
17+
name: Build and Deploy FFmpeg
18+
runs-on: ubuntu-latest
19+
permissions: write-all
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@main
23+
with:
24+
persist-credentials: false
25+
fetch-depth: 0
26+
- name: Set up containerd image store feature
27+
uses: nick-invision/retry@master
28+
with:
29+
timeout_minutes: 10
30+
max_attempts: 3
31+
command: |
32+
make setup_dev_env
33+
- name: Output Docker info
34+
run: docker info
35+
- name: Sets build date
36+
run: |
37+
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
38+
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
39+
make set_build_multiarch
40+
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
41+
env:
42+
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
43+
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
44+
- name: Build images
45+
uses: nick-invision/retry@master
46+
with:
47+
timeout_minutes: 90
48+
max_attempts: 2
49+
retry_wait_seconds: 60
50+
command: PLATFORMS="${PLATFORMS}" make ffmpeg
51+
- name: Login Docker Hub
52+
if: ${{ github.event.inputs.release == 'true' }}
53+
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
54+
env:
55+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
56+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
57+
- name: Deploy new images
58+
if: ${{ github.event.inputs.release == 'true' }}
59+
uses: nick-invision/retry@master
60+
with:
61+
timeout_minutes: 20
62+
max_attempts: 5
63+
retry_wait_seconds: 300
64+
continue_on_error: true
65+
command: |
66+
make tag_ffmpeg_latest
67+
make release_ffmpeg_latest

Video/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN apt-get -qqy update \
2020
libx11-6 libxcb1 libxcb-shm0 \
2121
x11-xserver-utils x11-utils \
2222
python3-pip \
23-
&& pip install --break-system-packages --no-cache-dir setuptools psutil \
23+
&& pip install --upgrade --break-system-packages --no-cache-dir pip setuptools psutil \
2424
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2525

2626
COPY *.conf /etc/supervisor/conf.d/

0 commit comments

Comments
 (0)