Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile without web renderer #344

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ jobs:

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

- name: Build image
run: docker build -t video-compositor .
- uses: hadolint/[email protected]
with:
dockerfile: build-tools/docker/full.Dockerfile

- name: Build image - slim
run: docker build -f build-tools/docker/slim.Dockerfile -t video-compositor .

- name: Build image - full
run: docker build -f build-tools/docker/full.Dockerfile -t video-compositor .
2 changes: 1 addition & 1 deletion Dockerfile → build-tools/docker/full.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG USERNAME=compositor

ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES compute,graphics,utility
ENV NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility

ENV MEMBRANE_VIDEO_COMPOSITOR_MAIN_EXECUTABLE_PATH=/home/$USERNAME/video_compositor/main_process
ENV MEMBRANE_VIDEO_COMPOSITOR_PROCESS_HELPER_PATH=/home/$USERNAME/video_compositor/process_helper
Expand Down
52 changes: 52 additions & 0 deletions build-tools/docker/slim.Dockerfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if slim is self-explanatory. Maybe so use some name indicating that it removes the web renderer

Copy link
Member Author

@wkozyra95 wkozyra95 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if slim is self-explanatory

You are assuming here that slim image means that it's compositor without web renderer :D

It depends what this file is suppose to mean.

  • If it is intended to be smaller image with minimal set of feature that do not have any significant downsides (e.g. large size, security issues) then this name is self explanatory and consistent with existing naming conventions
  • If it is intended to be full compositor with just web renderer disabled then yes name is not self-explantory

I decided to go with slim because from those 2 approaches it seem to me slightly better, but I don't feel strongly about it.

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"]
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",
"build-tools/docker/slim.Dockerfile",
"-t",
"video-compositor",
".",
])
.spawn()?;
let exit_code = process.wait()?;
if Some(0) != exit_code.code() {
Expand Down
Loading