Skip to content

Commit

Permalink
refactor: dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Jan 5, 2024
1 parent 4d11877 commit 0cd6dc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Dockerfile.client
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@ RUN apt install -y --no-install-recommends cargo cargo-c

WORKDIR /app

FROM builder AS builder-client

COPY . .

RUN cargo build --package=whipinto --release
RUN cargo build --package=whepfrom --release

FROM builder AS builder-gstreamer

ADD https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/archive/gstreamer-1.22.8/gst-plugins-rs-gstreamer-1.22.8.tar.gz gst-plugins-rs-gstreamer.tar.gz

RUN tar -xf gst-plugins-rs-gstreamer.tar.gz --strip-components 1

# whip / whep: protocol support
RUN cargo cinstall -p gst-plugin-webrtchttp --prefix=/usr --libdir=/usr/lib/$(gcc -dumpmachine)
RUN cargo cinstall -p gst-plugin-webrtchttp --libdir=pkg/usr/lib/$(gcc -dumpmachine)
# gst-plugin-webrtchttp
# - usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstwebrtchttp.a
# - usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstwebrtchttp.so
# - usr/lib/$(gcc -dumpmachine)/pkgconfig/gstwebrtchttp.pc
RUN rm pkg/usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstwebrtchttp.a

# rtpav1pay / rtpav1depay: RTP (de)payloader for the AV1 video codec.
RUN cargo cinstall -p gst-plugin-rtp --prefix=/usr --libdir=/usr/lib/$(gcc -dumpmachine)
RUN cargo cinstall -p gst-plugin-rtp --libdir=pkg/usr/lib/$(gcc -dumpmachine)
# gst-plugin-rtp
# - usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstrsrtp.a
# - usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstrsrtp.so
# - usr/lib/$(gcc -dumpmachine)/pkgconfig/gstrsrtp.pc
RUN rm pkg/usr/lib/$(gcc -dumpmachine)/gstreamer-1.0/libgstrsrtp.a

FROM common

COPY --from=builder-client /app/target/release/whipinto /usr/local/bin/whipinto
COPY --from=builder-client /app/target/release/whepfrom /usr/local/bin/whepfrom
COPY --from=builder /app/pkg/ /

CMD ["sh", "-c", "gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,format=I420 ! vp8enc ! rtpvp8pay ! whipsink whip-endpoint=http://localhost:3000/whip/777"]
CMD ["sh", "-c", "gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,format=I420 ! vp8enc ! rtpvp8pay ! whipsink whip-endpoint=http://localhost:7777/whip/777"]
6 changes: 6 additions & 0 deletions Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ COPY . .

RUN cargo build --release

RUN cargo build --package=whipinto --release
RUN cargo build --package=whepfrom --release

FROM debian:bookworm-slim

COPY --from=builder /app/config-dist.toml /etc/live777/config.toml
COPY --from=builder /app/target/release/live777 /usr/local/bin/live777

COPY --from=builder /app/target/release/whipinto /usr/local/bin/whipinto
COPY --from=builder /app/target/release/whepfrom /usr/local/bin/whepfrom

CMD ["live777"]

0 comments on commit 0cd6dc0

Please sign in to comment.