Skip to content
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

Alternatives for more modular builds and patches support #216

Open
wader opened this issue Jun 28, 2022 · 2 comments
Open

Alternatives for more modular builds and patches support #216

wader opened this issue Jun 28, 2022 · 2 comments

Comments

@wader
Copy link
Owner

wader commented Jun 28, 2022

Make it possible to enable/disable features when building. Alos thinking about adding some kind of optional patches support. Ex: put files in a patches directory and then will be applied in sorted order. Maybe patches/$FEATURE/001-fix.patch?

I think an ideal usage would be something like this:

# as before, all features enabled
docker build .

# all except rav1e
docker build --build-arg FEATURES="-rav1e" .

# no features at all
docker build --build-arg FEATURES="-all" .

# only libfdk-aac
docker build --build-arg FEATURES="-all +libfdk-aac" .

Issues to think about:

  • Build cache (one RUN running a big shell script can not use cache)
  • Feature dependencies (libogg needed by libvorbis etc)
  • How to keep it simple. I currently like that it is just a very standard Dockerfile without many moving parts of big helper scripts
  • Would be nice if all things for a feature could be kept together. Currently verison, build instructions is separate from ffmpeg args
  • Possibly could use heredoc but maybe a too new feature
  • Normalize feature names. vorbis -> libvorbis etc? use what ffmpeg calls it?

Possible implementation combining simple Dockerfile, cache friendly and no big shell script:

ARG FEATURES

# embed or COPY scripts for enable/enabled/download etc

# enable all dependencies and eval $FEATURES
RUN enabled \
  fontconfig \
  gray \
  ... \
  $FEATURES

...
# handle dependencies
RUN \
  enabled vorbis && enable ogg; \
  ...

...

libogg build here

...

# bump: vorbis /VORBIS_VERSION=([\d.]+)/ https://github.com/xiph/vorbis.git|*
# bump: vorbis after ./hashupdate Dockerfile VORBIS $LATEST
# bump: vorbis link "CHANGES" https://github.com/xiph/vorbis/blob/master/CHANGES
# bump: vorbis link "Source diff $CURRENT..$LATEST" https://github.com/xiph/vorbis/compare/v$CURRENT..v$LATEST
ARG VORBIS_VERSION=1.3.7
ARG VORBIS_URL="https://downloads.xiph.org/releases/vorbis/libvorbis-$VORBIS_VERSION.tar.gz"
ARG VORBIS_SHA256=0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab
RUN if enabled vorbis; then \
  download $DAV1D_URL $DAV1D_SHA256 && \
  add-version vorbis $VORBIS_VERSION && \
  ffmpeg-configure --enable-libvorbis && \
  cd libvorbis-* && ./configure --disable-shared --enable-static --disable-oggtest && \
  make -j$(nproc) install \
fi

A simple way to implement enable/enabled is to just use files in a directory, so enable would for +?name do touch /featurs/$1, for -name do rm /featurs/$1 and for -all do rm /features/*. add-version could just append to a JSON file. ffmpeg-configure just append to a file and download wrapper around wget and checksum check.

@wader wader changed the title Alternatives for more modular builds Alternatives for more modular builds and patches support Jun 28, 2022
@mathieu-aubin
Copy link
Contributor

mathieu-aubin commented Jul 2, 2022

did you read this -> https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/

and of so, is it relevant? not much time npw but i figured id input

this one too -> https://hub.docker.com/r/linuxserver/ffmpeg

@wader
Copy link
Owner Author

wader commented Jul 2, 2022

@mathieu-aubin hey, replied here #217 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants