47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
FROM rust:1-bookworm AS builder
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
libopus-dev \
|
|
libsqlite3-dev \
|
|
clang \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/server/Cargo.toml crates/server/Cargo.toml
|
|
COPY crates/entity/Cargo.toml crates/entity/Cargo.toml
|
|
COPY crates/migration/Cargo.toml crates/migration/Cargo.toml
|
|
|
|
RUN mkdir -p crates/server/src crates/entity/src crates/migration/src \
|
|
&& echo "fn main() {}" > crates/server/src/main.rs \
|
|
&& echo "" > crates/entity/src/lib.rs \
|
|
&& echo "" > crates/migration/src/lib.rs
|
|
|
|
ENV RUSTFLAGS=""
|
|
|
|
RUN cargo build --release --bin rtmp-to-whip
|
|
|
|
COPY crates crates
|
|
RUN touch crates/server/src/main.rs crates/entity/src/lib.rs crates/migration/src/lib.rs \
|
|
&& cargo build --release --bin rtmp-to-whip \
|
|
&& strip target/release/rtmp-to-whip
|
|
|
|
RUN mkdir /deps \
|
|
&& ldd target/release/rtmp-to-whip \
|
|
| awk 'NF==4{print $3} NF==2{print $1}' \
|
|
| grep -v vdso \
|
|
| xargs -I{} cp --parents {} /deps
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /deps /
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
|
COPY --from=builder /app/target/release/rtmp-to-whip /rtmp-to-whip
|
|
|
|
EXPOSE 1935
|
|
EXPOSE 3000
|
|
EXPOSE 6969/udp
|
|
|
|
CMD ["/rtmp-to-whip"]
|