59 lines
2.2 KiB
Docker
59 lines
2.2 KiB
Docker
FROM --platform=linux/amd64 rust:1-bookworm AS builder
|
|
|
|
RUN dpkg --add-architecture arm64 \
|
|
&& apt-get update && apt-get install -y \
|
|
gcc-aarch64-linux-gnu \
|
|
libopus-dev:arm64 \
|
|
libsqlite3-dev:arm64 \
|
|
libc6:arm64 \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN rustup target add aarch64-unknown-linux-gnu
|
|
|
|
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
|
PKG_CONFIG_ALLOW_CROSS=1 \
|
|
PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig \
|
|
RUSTFLAGS=""
|
|
|
|
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
|
|
|
|
RUN cargo build --release --target aarch64-unknown-linux-gnu --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 --target aarch64-unknown-linux-gnu --bin rtmp-to-whip \
|
|
&& aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/rtmp-to-whip
|
|
|
|
RUN mkdir /deps \
|
|
&& find /usr/lib/aarch64-linux-gnu -name 'libopus.so*' -exec cp --parents {} /deps \; \
|
|
&& find /usr/lib/aarch64-linux-gnu -name 'libsqlite3.so*' -exec cp --parents {} /deps \; \
|
|
&& find /lib/aarch64-linux-gnu -name 'libc*' -exec cp --parents {} /deps \; \
|
|
&& find /lib/aarch64-linux-gnu -name 'libm*' -exec cp --parents {} /deps \; \
|
|
&& find /lib/aarch64-linux-gnu -name 'libpthread*' -exec cp --parents {} /deps \; \
|
|
&& find /lib/aarch64-linux-gnu -name 'libdl*' -exec cp --parents {} /deps \; \
|
|
&& find /lib/aarch64-linux-gnu -name 'libgcc_s*' -exec cp --parents {} /deps \; \
|
|
&& cp --parents /lib/ld-linux-aarch64.so.1 /deps
|
|
|
|
FROM --platform=linux/arm64/v8 scratch
|
|
|
|
COPY --from=builder /deps /
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
|
COPY --from=builder /app/target/aarch64-unknown-linux-gnu/release/rtmp-to-whip /rtmp-to-whip
|
|
|
|
EXPOSE 1935
|
|
EXPOSE 3000
|
|
EXPOSE 6969/udp
|
|
|
|
CMD ["/rtmp-to-whip"]
|