Skip to content

Commit

Permalink
Add separate dockerfile without web renderer support
Browse files Browse the repository at this point in the history
  • Loading branch information
wkozyra95 committed Jan 8, 2024
1 parent cd306eb commit 9f7460c
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:

- uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
dockerfile: slim.Dockerfile

- uses: hadolint/[email protected]
with:
dockerfile: full.Dockerfile

- name: Build image
run: docker build -t video-compositor .
run: docker build -f slim.Dockerfile -t video-compositor .
9 changes: 8 additions & 1 deletion examples/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ fn build_and_start_docker(skip_build: bool) -> Result<()> {
if !skip_build {
info!("[example] docker build");
let mut process = Command::new("docker")
.args(["build", "-t", "video-compositor", "."])
.args([
"build",
"-f",
"slim.Dockerfile",
"-t",
"video-compositor",
".",
])
.spawn()?;
let exit_code = process.wait()?;
if Some(0) != exit_code.code() {
Expand Down
File renamed without changes.
52 changes: 52 additions & 0 deletions slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Builder image
FROM ubuntu:mantic-20231011 as builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor
ARG RUST_VERSION=1.74

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y -qq && \
apt-get install -y \
build-essential curl pkg-config libssl-dev libclang-dev git sudo \
libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers \
ffmpeg libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev && \
rm -rf /var/lib/apt/lists/*

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN source ~/.cargo/env && rustup install $RUST_VERSION && rustup default $RUST_VERSION

COPY . /root/project
WORKDIR /root/project

RUN source ~/.cargo/env && cargo build --release --no-default-features

# Runtime image
FROM ubuntu:mantic-20231011

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG USERNAME=compositor

ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES compute,graphics,utility

RUN apt-get update -y -qq && \
apt-get install -y \
sudo adduser ffmpeg && \
rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash $USERNAME && adduser $USERNAME sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USERNAME
RUN mkdir -p /home/$USERNAME/video_compositor
WORKDIR /home/$USERNAME/video_compositor

COPY --from=builder --chown=$USERNAME:$USERNAME /root/project/target/release/main_process /home/$USERNAME/video_compositor/main_process

ENV LIVE_COMPOSITOR_WEB_RENDERER_ENABLE=0
ENV LIVE_COMPOSITOR_WEB_RENDERER_GPU_ENABLE=0

ENTRYPOINT ["/home/compositor/video_compositor/main_process"]

0 comments on commit 9f7460c

Please sign in to comment.