dash-mpd-cli 0.2.9

Download media content from a DASH-MPEG or DASH-WebM MPD manifest.
# Build the container with
#
#    podman build -f Dockerfile --tag dash-mpd-cli
#    podman images
#    podman run -ti -v /tmp:/tmp localhost/dash-mpd-cli dash-mpd-cli -v https://cloudflarestream.com/31c9291ab41fac05471db4e73aa11717/manifest/video.mpd -o /tmp/foo.mp4
#    

FROM docker.io/rust:latest AS builder

RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev
RUN update-ca-certificates

ENV USER=dashmpd
ENV UID=10001

RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "/nonexistent" \
    --shell "/sbin/nologin" \
    --no-create-home \
    --uid "${UID}" \
    "${USER}"

WORKDIR /dashmpd
COPY ./ ./
RUN cargo update
RUN cargo build --target x86_64-unknown-linux-musl --release


# Now build the final image
FROM alpine
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group

# install ffmpeg, mkvmerge, mp4box, mp4decrypt, shaka packager etc. GPAC is not packaged in Alpine Linux?
RUN apk update
RUN apk upgrade
RUN apk add --no-cache wget
RUN apk add --no-cache ffmpeg
RUN apk add --no-cache mkvtoolnix
RUN apk add --no-cache vlc
RUN apk add --no-cache bento4
RUN apk add --no-cache libxslt
RUN wget -q -O /tmp/shaka-packager https://github.com/shaka-project/shaka-packager/releases/latest/download/packager-linux-x64
RUN mv /tmp/shaka-packager /usr/local/bin
RUN chmod +x /usr/local/bin/shaka-packager

WORKDIR /dashmpd

COPY --from=builder /dashmpd/target/x86_64-unknown-linux-musl/release/dash-mpd-cli /usr/local/bin

# Use an unprivileged user.
USER dashmpd:dashmpd
CMD ["/usr/local/bin/dash-mpd-cli"]