2022-03-16 01:52:27 +00:00
|
|
|
FROM archlinux:base-devel AS base
|
2021-01-18 02:13:24 +00:00
|
|
|
|
2022-06-30 19:19:26 +00:00
|
|
|
RUN pacman -Syyu --noconfirm
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
# Install dependancies needed by all steps including runtime step
|
|
|
|
RUN pacman -S --noconfirm aom ffmpeg vapoursynth ffms2 libvpx mkvtoolnix-cli svt-av1 vapoursynth-plugin-lsmashsource vmaf
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
FROM base AS build-base
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
# Install dependancies needed by build steps
|
|
|
|
RUN pacman -S --noconfirm rust clang nasm git
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-06-30 19:19:26 +00:00
|
|
|
# TODO reimplement caching via cargo-chef after it properly fixes its --profile support
|
|
|
|
# RUN cargo install cargo-chef
|
2022-03-16 01:52:27 +00:00
|
|
|
WORKDIR /tmp/Av1an
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
FROM build-base AS planner
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-06-30 19:19:26 +00:00
|
|
|
# See previous TODO
|
|
|
|
# COPY . .
|
|
|
|
# RUN cargo chef prepare
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
FROM build-base AS cacher
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-06-30 19:19:26 +00:00
|
|
|
# See previous TODO
|
|
|
|
# COPY --from=planner /tmp/Av1an/recipe.json recipe.json
|
|
|
|
# RUN cargo chef cook --release
|
2021-01-31 21:20:23 +00:00
|
|
|
|
2022-01-20 02:35:38 +00:00
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
FROM build-base AS build
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
# Compile rav1e from git, as archlinux is still on rav1e 0.4
|
2022-03-16 01:52:27 +00:00
|
|
|
RUN git clone https://github.com/xiph/rav1e && \
|
|
|
|
cd rav1e && \
|
|
|
|
cargo build --release && \
|
|
|
|
strip ./target/release/rav1e && \
|
|
|
|
mv ./target/release/rav1e /usr/local/bin && \
|
|
|
|
cd .. && rm -rf ./rav1e
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
# Build av1an
|
|
|
|
COPY . /tmp/Av1an
|
|
|
|
|
2022-06-30 19:19:26 +00:00
|
|
|
# See previous TODO
|
2022-03-14 14:54:45 +00:00
|
|
|
# Copy over the cached dependencies
|
2022-06-30 19:19:26 +00:00
|
|
|
# COPY --from=cacher /tmp/Av1an/target /tmp/Av1an/target
|
2022-03-14 14:54:45 +00:00
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
RUN cargo build --release && \
|
|
|
|
mv ./target/release/av1an /usr/local/bin && \
|
|
|
|
cd .. && rm -rf ./Av1an
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
|
2022-03-16 01:52:27 +00:00
|
|
|
FROM base AS runtime
|
2022-03-14 14:54:45 +00:00
|
|
|
|
|
|
|
ENV MPLCONFIGDIR="/home/app_user/"
|
|
|
|
|
|
|
|
COPY --from=build /usr/local/bin/rav1e /usr/local/bin/rav1e
|
|
|
|
COPY --from=build /usr/local/bin/av1an /usr/local/bin/av1an
|
2021-01-18 02:13:24 +00:00
|
|
|
|
2022-02-08 22:26:39 +00:00
|
|
|
# Create user
|
|
|
|
RUN useradd -ms /bin/bash app_user
|
|
|
|
USER app_user
|
2021-07-09 16:32:47 +00:00
|
|
|
|
2021-01-18 02:13:24 +00:00
|
|
|
VOLUME ["/videos"]
|
|
|
|
WORKDIR /videos
|
|
|
|
|
2022-02-08 22:26:39 +00:00
|
|
|
ENTRYPOINT [ "/usr/local/bin/av1an" ]
|