From a9d2c11ce25d8d73a4bc884047b6994eaf1f46aa Mon Sep 17 00:00:00 2001 From: kieran Date: Tue, 26 Mar 2024 23:15:38 +0000 Subject: [PATCH] Docker build --- .dockerignore | 3 +++ Dockerfile | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5624211 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +target/ +.git/ +out/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ceddba8..60b7b03 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,36 @@ -FROM ubuntu:latest -LABEL authors="Kieran" +ARG IMAGE=rust:bookworm -ENTRYPOINT ["top", "-b"] \ No newline at end of file +FROM $IMAGE as build +WORKDIR /app/src +ENV FFMPEG_DIR=/app/ffmpeg +COPY . . +RUN apt update && \ + apt install -y \ + build-essential \ + libx264-dev \ + nasm \ + libclang-dev && \ + rm -rf /var/lib/apt/lists/* +RUN git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git && \ + cd ffmpeg && \ + ./configure \ + --prefix=$FFMPEG_DIR \ + --disable-programs \ + --disable-doc \ + --disable-network \ + --enable-gpl \ + --enable-version3 \ + --enable-libx264 \ + --disable-static \ + --enable-shared && \ + make -j8 && make install +RUN cargo install --path . --root /app/build + +FROM $IMAGE as runner +WORKDIR /app +RUN apt update && \ + apt install -y libx264-164 && \ + rm -rf /var/lib/apt/lists/* +COPY --from=build /app/build . +COPY --from=build /app/ffmpeg/lib/ /lib +ENTRYPOINT ["/app/bin/stream-core"] \ No newline at end of file