-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile.j2
More file actions
74 lines (66 loc) · 4.33 KB
/
Copy pathContainerfile.j2
File metadata and controls
74 lines (66 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{%- set build_tools = "FreeBSD-bmake FreeBSD-clibs-dev FreeBSD-clang FreeBSD-clang-dev FreeBSD-toolchain FreeBSD-utilities-dev FreeBSD-runtime-dev FreeBSD-zlib-dev FreeBSD-bzip2-dev FreeBSD-openssl-dev FreeBSD-xz-dev nasm vulkan-headers quilt pkgconf gmake perl5" -%}
{%- set runtime_deps = "libass libbluray chromaprint dav1d fdk-aac fontconfig freetype2 fribidi gmp harfbuzz lame libopenmpt opus libplacebo shaderc svt-av1 libtheora libvorbis libvpx vulkan-loader webp libx264 x265 sekrit-twc-zimg libzvbi gnutls libxml2 libiconv libva libdrm libvdpau libX11 alsa-lib sndio" -%}
ARG BASE_VERSION=15.1
ARG FREEBSD_ARCH=amd64
# Which overlay port this tag builds. Selected per variant (:7 / :8) in
# .daemonless/config.yaml; jellyfin-ffmpeg7 also carries the unversioned alias.
ARG JFFMPEG_PORT=jellyfin-ffmpeg7
# ---------------------------------------------------------------------------
# Stage 1: compile the selected jellyfin-ffmpeg overlay port and package it.
# build_tools + runtime_deps are only needed to compile/link ffmpeg here; the
# final image gets the runtime libs back via `pkg install` of the .pkg (its
# recorded LIB_DEPENDS), so none of the toolchain leaks into the product.
# ---------------------------------------------------------------------------
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
ARG JFFMPEG_PORT
RUN pkg update && pkg install -y git \
{{ build_tools }} \
{{ runtime_deps }} \
&& pkg clean -ay
# Minimal ports infrastructure (Mk/Templates/Keywords) + our overlay port
RUN fetch -qo /tmp/ports.tar.zst \
"https://download.freebsd.org/ports/ports/ports.tar.zst" && \
mkdir -p /usr/ports/multimedia && \
tar -xf /tmp/ports.tar.zst -C /usr/ports --strip-components=1 \
ports/Mk ports/Templates ports/Keywords && \
rm /tmp/ports.tar.zst && \
git clone --depth=1 https://github.com/daemonless/freebsd-ports.git /tmp/freebsd-ports && \
cp -r /tmp/freebsd-ports/multimedia/${JFFMPEG_PORT} /usr/ports/multimedia/ && \
rm -rf /tmp/freebsd-ports
RUN cd /usr/ports/multimedia/${JFFMPEG_PORT} && \
make BATCH=yes MAKE_JOBS_NUMBER=4 install clean && \
mkdir -p /packages && pkg create -o /packages ${JFFMPEG_PORT}
# ---------------------------------------------------------------------------
# Stage 2: standalone, runnable ffmpeg image for this line. `pkg install`
# (not `add`) pulls the port's recorded runtime deps so they register in the
# pkg DB and show up in the SBOM. We COPY the .pkg from the builder (FreeBSD
# podman/ocijail does not support RUN --mount=type=bind,from=<stage>); this
# mirrors how base, playwright and immich move packages between stages.
# ---------------------------------------------------------------------------
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG JFFMPEG_PORT
LABEL org.opencontainers.image.title="Jellyfin FFmpeg" \
org.opencontainers.image.description="FFmpeg with Jellyfin patches for HDR tone mapping (tonemapx/libplacebo) on FreeBSD" \
org.opencontainers.image.source="https://github.com/daemonless/jellyfin-ffmpeg" \
org.opencontainers.image.url="https://github.com/jellyfin/jellyfin-ffmpeg" \
org.opencontainers.image.licenses="GPL-2.0-or-later AND LGPL-2.1-or-later" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Utilities" \
io.daemonless.upstream-url="https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/latest" \
io.daemonless.upstream-jq=".tag_name" \
io.daemonless.arch="${FREEBSD_ARCH}"
# Install the .pkg (auto-resolves runtime deps -> SBOM) and expose a generic
# ffmpeg/ffprobe pointing at this line's binary, so the entrypoint is uniform
# across the :7 and :8 tags.
COPY --from=builder /packages/ /tmp/pkgs/
RUN pkg install -y /tmp/pkgs/${JFFMPEG_PORT}-*.pkg && \
rm -rf /tmp/pkgs && \
pkg clean -ay && \
ln -sf /usr/local/bin/${JFFMPEG_PORT} /usr/local/bin/ffmpeg && \
ln -sf /usr/local/bin/$(echo ${JFFMPEG_PORT} | sed 's/ffmpeg/ffprobe/') /usr/local/bin/ffprobe && \
mkdir -p /app && pkg query '%v' ${JFFMPEG_PORT} > /app/version
# CLI tool, not an s6 service. `ffmpeg` = this tag's jellyfin-ffmpeg line;
# the versioned jellyfin-ffmpeg7 / jellyfin-ffmpeg8 binaries are also on PATH.
# podman run --rm ghcr.io/daemonless/jellyfin-ffmpeg:7 -i in.mkv ... out.mp4
ENTRYPOINT ["/usr/local/bin/ffmpeg"]