Skip to content

Commit a580cb2

Browse files
committed
Add static build test
1 parent 066f62c commit a580cb2

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "static:ffmpeg-alpine"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 7.1
8+
9+
jobs:
10+
build-static:
11+
runs-on: [self-hosted]
12+
strategy:
13+
matrix:
14+
include:
15+
- ffmpeg_version: "7.1.1"
16+
os: alpine
17+
os_version: "3.21"
18+
platforms: linux/amd64,linux/arm64,linux/arm/v7
19+
20+
steps:
21+
- name: Get current date
22+
run: echo "CURRENT_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_ENV"
23+
24+
- name: Get current commit
25+
run: echo "CURRENT_COMMIT=$(echo ${GITHUB_SHA} | head -c 7)" >> "$GITHUB_ENV"
26+
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
with:
33+
platforms: all
34+
35+
- name: Set up Docker Buildx
36+
id: buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Build static FFmpeg binary
40+
uses: docker/build-push-action@v5
41+
with:
42+
builder: ${{ steps.buildx.outputs.name }}
43+
context: .
44+
file: ./Dockerfile.static
45+
build-args: |
46+
BUILD_IMAGE=${{ matrix.os }}:${{ matrix.os_version }}
47+
BUILD_DATE=${{ env.CURRENT_DATE }}
48+
BUILD_COMMIT=${{ env.CURRENT_COMMIT }}
49+
FFMPEG_VERSION=${{ matrix.ffmpeg_version }}
50+
platforms: ${{ matrix.platforms }}
51+
outputs: type=local,dest=./out
52+
53+
- name: Upload static ffmpeg binary
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ffmpeg-${{ matrix.platforms }}
57+
path: ./out/bin/ffmpeg

Dockerfile.static

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Filename: Dockerfile.static
2+
3+
FROM alpine:3.15 AS builder
4+
5+
ARG BUILD_DATE=1970-01-01T00:00:00Z
6+
ARG BUILD_COMMIT=unknown
7+
ARG FFMPEG_VERSION=6.1
8+
9+
ENV SRC=/usr \
10+
PKG_CONFIG_PATH=/usr/lib/pkgconfig \
11+
MAKEFLAGS=-j$(nproc)
12+
13+
# Install build dependencies
14+
RUN apk add --no-cache \
15+
autoconf automake bash binutils bzip2 ca-certificates \
16+
cmake coreutils curl diffutils g++ gcc libgcc libtool \
17+
libssl3 linux-headers make musl-dev nasm openssl-dev \
18+
patch tar zlib-dev harfbuzz-dev freetype-dev libxml2-dev \
19+
libsrt-dev x264-dev x265-dev libvpx-dev lame-dev opus-dev \
20+
libvorbis-dev fdk-aac-dev dav1d-dev rav1e-dev aom-dev \
21+
libxcb-dev alsa-lib-dev v4l-utils-dev
22+
23+
WORKDIR /tmp
24+
25+
# FFmpeg Quellen holen
26+
RUN curl -LO http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
27+
tar -xzf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
28+
rm ffmpeg-${FFMPEG_VERSION}.tar.gz
29+
30+
COPY ./contrib /contrib
31+
32+
# Konfigurieren & statisch kompilieren
33+
RUN cd ffmpeg-${FFMPEG_VERSION} && \
34+
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
35+
patch -p1 < /contrib/ffmpeg-hls.patch && \
36+
./configure \
37+
--extra-version="datarhei-${BUILD_COMMIT}-${BUILD_DATE}" \
38+
--prefix="${SRC}" \
39+
--extra-libs="-lpthread -lxml2 -lm -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl" \
40+
--enable-nonfree \
41+
--enable-gpl \
42+
--enable-version3 \
43+
--enable-postproc \
44+
--enable-static \
45+
--disable-shared \
46+
--disable-ffplay \
47+
--disable-debug \
48+
--disable-doc \
49+
--enable-openssl \
50+
--enable-libxml2 \
51+
--enable-libv4l2 \
52+
--enable-v4l2_m2m \
53+
--enable-libfreetype \
54+
--enable-alsa \
55+
--enable-libsrt \
56+
--enable-libx264 \
57+
--enable-libx265 \
58+
--enable-libvpx \
59+
--enable-libmp3lame \
60+
--enable-libopus \
61+
--enable-libvorbis \
62+
--enable-libfdk-aac \
63+
--enable-libdav1d \
64+
--enable-librav1e \
65+
--enable-libaom \
66+
--enable-libxcb && \
67+
make && make install
68+
69+
# Output stage (nur statische Binarys)
70+
FROM scratch AS binary
71+
COPY --from=builder /usr/bin/ffmpeg /bin/ffmpeg

0 commit comments

Comments
 (0)