-
Notifications
You must be signed in to change notification settings - Fork 35
Update ffmpeg and change static build provider #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
68a1256
4575a56
56c8c09
5f938da
2692ad5
05a63a1
a724b78
f460cf2
f06f24d
95ab4be
0133b6f
fe3e0e5
d4db75e
3cc12de
c360d31
9d94b9a
2f19ef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ | |
| go build -ldflags="-s -w" -o /out/kernel-images-api ./cmd/api | ||
|
|
||
| # Build chromium launcher | ||
| RUN GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} \ | ||
| RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
| --mount=type=cache,target=/go/pkg/mod \ | ||
| GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} \ | ||
| go build -ldflags="-s -w" -o /out/chromium-launcher ./cmd/chromium-launcher | ||
|
|
||
| # webrtc client | ||
|
|
@@ -60,6 +62,50 @@ RUN set -eux; \ | |
| make -j$(nproc); \ | ||
| make install; | ||
|
|
||
| FROM docker.io/ubuntu:22.04 AS ffmpeg-downloader | ||
| RUN --mount=type=cache,target=/var/cache/apt,sharing=private,id=ubuntu2204-aptcache \ | ||
| --mount=type=cache,target=/var/lib/apt,sharing=private,id=ubuntu2204-aptlib \ | ||
| rm -f /etc/apt/apt.conf.d/docker-clean; \ | ||
| echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache; \ | ||
| set -xe; \ | ||
| apt-get -yqq update; \ | ||
| apt-get -yqq --no-install-recommends install ca-certificates curl xz-utils; | ||
|
|
||
| # Download FFmpeg (latest static build) for the recording server | ||
| RUN --mount=type=cache,target=/tmp/cache/ffmpeg,sharing=private,id=ffmpeg \ | ||
| <<-'EOT' | ||
| set -eux | ||
| ARCHIVE_NAME="ffmpeg-master-latest-linux64-gpl.tar.xz" | ||
Sayan- marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| URL="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/$ARCHIVE_NAME" | ||
| echo "Downloading FFmpeg checksum" | ||
| if ! curl --connect-timeout 10 -fsSL "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/checksums.sha256" -o /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256; then | ||
| echo "Failed to connect to ffmpeg static build provider for checksum." | ||
| echo "Checking for cached version to use." | ||
| if [ ! -f /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256 ]; then | ||
| echo "Unable to locate cached checksum. Exiting." | ||
| exit 1 | ||
| else | ||
| echo "Found cached checksum." | ||
| fi | ||
| fi | ||
| grep -F "$ARCHIVE_NAME" /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256 > /tmp/cache/ffmpeg/tmp_sha256_only | ||
| mv /tmp/cache/ffmpeg/tmp_sha256_only /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256 | ||
| sed -i -e 's/ .*$/ \/tmp\/cache\/ffmpeg\/ffmpeg.tar.xz/' /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256 | ||
| echo "Checking cache for FFmpeg archive and validating checksum" | ||
| if sha256sum --check /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256; then | ||
| echo "Checksum validated, using cached FFmpeg archive" | ||
| else | ||
| echo "Downloading FFmpeg static build from $URL" | ||
| curl -fsSL "$URL" -o /tmp/cache/ffmpeg/ffmpeg.tar.xz | ||
| echo "Validating checksum of FFmpeg static build download" | ||
| sha256sum --check /tmp/cache/ffmpeg/ffmpeg.tar.xz.sha256 | ||
| fi | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: FFmpeg Build Failures Due to Checksum Validation IssuesThe FFmpeg download and caching logic has a couple of issues that can cause builds to fail. If the remote checksum download fails, a newly fetched 'latest' archive is incorrectly validated against an outdated cached checksum. Separately, if the archive name isn't found in the checksum file, the file can be corrupted, preventing successful validation. Additional Locations (1) |
||
| tar -xJf /tmp/cache/ffmpeg/ffmpeg.tar.xz -C /tmp | ||
| install -m755 /tmp/ffmpeg-*/bin/ffmpeg /usr/local/bin/ffmpeg | ||
| install -m755 /tmp/ffmpeg-*/bin/ffprobe /usr/local/bin/ffprobe | ||
| rm -rf /tmp/ffmpeg* | ||
| EOT | ||
|
|
||
| FROM ghcr.io/onkernel/neko/base:3.0.8-v1.3.0 AS neko | ||
| # ^--- now has event.SYSTEM_PONG with legacy support to keepalive | ||
| FROM node:22-bullseye-slim AS node-22 | ||
|
|
@@ -119,40 +165,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private,id=ubuntu2204-aptca | |
| fonts-nanum \ | ||
| fontconfig \ | ||
| unzip && \ | ||
| apt-get clean && fc-cache -f | ||
| fc-cache -f | ||
|
|
||
| # install ffmpeg manually since the version available in apt is from the 4.x branch due to #drama. | ||
| # as of writing these static builds will be the latest 7.0.x release. | ||
| RUN --mount=type=cache,target=/tmp/cache/ffmpeg,id=ffmpeg \ | ||
| <<-'EOT' | ||
| set -eux | ||
| URL="https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" | ||
| echo "Downloading FFmpeg MD5 checksum" | ||
| if ! curl --connect-timeout 10 -fsSL "${URL}.md5" -o /tmp/cache/ffmpeg/ffmpeg.tar.xz.md5; then | ||
| echo "Failed to connect to ffmpeg static build provider for MD5 checksum." | ||
| echo "Checking for cached version to use." | ||
| if [ ! -f /tmp/cache/ffmpeg/ffmpeg.tar.xz.md5 ]; then | ||
| echo "Unable to locate cached MD5 checksum. Exiting." | ||
| exit 1 | ||
| else | ||
| echo "Found cached MD5 checksum." | ||
| fi | ||
| fi | ||
| sed -i -e 's/ .*$/ \/tmp\/cache\/ffmpeg\/ffmpeg.tar.xz/' /tmp/cache/ffmpeg/ffmpeg.tar.xz.md5 | ||
| echo "Checking cache for FFmpeg archive and validating MD5 checksum" | ||
| if md5sum --check /tmp/cache/ffmpeg/ffmpeg.tar.xz.md5; then | ||
| echo "Checksum validated, using cached FFmpeg archive" | ||
| else | ||
| echo "Downloading FFmpeg static build from $URL" | ||
| curl -fsSL "$URL" -o /tmp/cache/ffmpeg/ffmpeg.tar.xz | ||
| echo "Validating MD5 checksum of FFmpeg static build download" | ||
| md5sum --check /tmp/cache/ffmpeg/ffmpeg.tar.xz.md5 | ||
| fi | ||
| tar -xJf /tmp/cache/ffmpeg/ffmpeg.tar.xz -C /tmp | ||
| install -m755 /tmp/ffmpeg-*/ffmpeg /usr/local/bin/ffmpeg | ||
| install -m755 /tmp/ffmpeg-*/ffprobe /usr/local/bin/ffprobe | ||
| rm -rf /tmp/ffmpeg* | ||
| EOT | ||
| COPY --from=ffmpeg-downloader /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg | ||
| COPY --from=ffmpeg-downloader /usr/local/bin/ffprobe /usr/local/bin/ffprobe | ||
|
|
||
| # runtime | ||
| ENV USERNAME=root | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context the failure I was seeing:
under the hood when running
build-docker.shon my macbook I ended up with the wrong arch