Skip to content

Commit 51a7a12

Browse files
authored
[ci] Add workflow to build and deploy FFmpeg tools image (#2507)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 521bd33 commit 51a7a12

File tree

3 files changed

+79
-5
lines changed

3 files changed

+79
-5
lines changed

.ffmpeg/Dockerfile

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ 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

89
#======================================
910
# Install build tools
1011
#======================================
1112
ARG TOOLS_DEPS="autoconf automake cmake libfreetype6 gcc build-essential libtool make nasm pkg-config zlib1g-dev numactl \
12-
libnuma-dev libx11-6 libxcb1 libxcb1-dev yasm git curl jq wget ca-certificates"
13+
libnuma-dev libx11-dev libxcb-shm0 libxcb1-dev yasm git curl jq wget ca-certificates"
1314

1415
RUN apt-get update -qqy \
1516
&& apt-get upgrade -yq \
@@ -30,6 +31,10 @@ RUN cd /usr/local/src \
3031
&& git clone https://github.com/rclone/rclone.git \
3132
&& cd rclone \
3233
&& git checkout $VERSION_RCLONE \
34+
# Patch deps version in go.mod to fix CVEs
35+
&& sed -i "s|golang.org/x/crypto v.*|golang.org/x/crypto ${GO_CRYPTO_VERSION}|g" go.mod \
36+
&& go mod tidy \
37+
# Build rclone
3338
&& make \
3439
&& mv ~/go/bin/rclone /usr/local/bin/ \
3540
&& rclone version
@@ -74,8 +79,9 @@ COPY --from=builder /usr/local/bin/rclone /usr/local/bin/rclone
7479

7580
RUN apt-get -qqy update \
7681
&& apt-get -qqy --no-install-recommends install \
77-
libx11-dev libxcb1 libxcb-shm0 \
82+
libx11-dev libxcb-shm0 libxcb1-dev \
7883
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
7984

80-
RUN ffmpeg -version \
85+
RUN ldd /usr/local/bin/ffmpeg \
86+
&& ffmpeg -version \
8187
&& rclone --version

.github/workflows/build-ffmpeg.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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: blacksmith-8vcpu-ubuntu-2204
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: 300
48+
max_attempts: 2
49+
retry_wait_seconds: 60
50+
command: |
51+
PLATFORMS="${PLATFORMS}" make ffmpeg
52+
make tag_ffmpeg_latest
53+
- name: Login Docker Hub
54+
if: ${{ github.event.inputs.release == 'true' }}
55+
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
56+
env:
57+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
58+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
59+
- name: Deploy new images
60+
if: ${{ github.event.inputs.release == 'true' }}
61+
uses: nick-invision/retry@master
62+
with:
63+
timeout_minutes: 20
64+
max_attempts: 5
65+
retry_wait_seconds: 300
66+
continue_on_error: true
67+
command: |
68+
make release_ffmpeg_latest

Video/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ COPY --from=source /usr/local/bin/rclone /usr/local/bin/rclone
1717

1818
RUN apt-get -qqy update \
1919
&& apt-get -qqy --no-install-recommends install \
20-
libx11-6 libxcb1 libxcb-shm0 \
20+
libx11-dev libxcb-shm0 libxcb1-dev \
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 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)