diff --git a/96_nerdctl/Dockerfile.ffmpeg b/96_nerdctl/Dockerfile.ffmpeg new file mode 100644 index 0000000..b2158bb --- /dev/null +++ b/96_nerdctl/Dockerfile.ffmpeg @@ -0,0 +1,74 @@ +# syntax=docker/dockerfile:1.4 +ARG baseimage="scratch" +FROM nixos/nix:latest AS BUILDER + +ARG FLAKE=ffmpeg + +WORKDIR /scratch + +COPY --chmod=755 < /etc/nix/nix.conf +experimental-features = nix-command flakes +# WARNING: This is a security risk - for arm builds only +filter-syscalls = false +HEREDOC +EOF +RUN "/scratch/enable-flakes.sh" + +COPY ./ffmpeg ./ + +# NOTE: Escape the \$ otherwise they are rendered at buildtime +COPY --chmod=755 < /scratch/libs.txt + cat /scratch/libs.txt | \${AWK_PROGRAM} 'NF == 4 { {print \$3} }' > /scratch/libs_extracted.txt + cat /scratch/libs_extracted.txt | \${AWK_PROGRAM} -F/ -vOFS=/ '{ print \$1,\$2,\$3,\$4; }' | sort -u >> /scratch/libs_paths.txt + cp "\$PROGRAM_FILE" /output/bin +done << PROGRAMS +\$FFMPEG_PROGRAM +PROGRAMS + +tar -cvf /scratch/libraries.tar -T /scratch/libs_paths.txt +tar xf /scratch/libraries.tar --directory=/output/libs +# remove includes and manpages (add this once tested - reduces image by 45MB) +find /output -iname "share" -or -iname "include" | xargs rm -rf +EOF + +RUN nix develop --impure --command bash -c '/scratch/exportldd.sh' + +CMD ["./output/bin/$PROGRAM_FILE", "-version"] + +FROM $baseimage AS PRODUCTION + +COPY --from=BUILDER /output/bin/ /usr/bin/ +COPY --from=BUILDER /output/libs / + +# NOTE: Escape the \$ otherwise they are rendered at buildtime +# If using distroless, use this instead +#!/busybox/env sh +COPY --chmod=755 <