Skip to content

Commit aa17006

Browse files
Dockerfile optimisations (#518)
1 parent 891607d commit aa17006

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

runner/docker/Dockerfile.live-base

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && \
1010
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
1111
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
1212
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git runit libzmq3-dev && \
13-
rm -rf /var/lib/apt/lists/*
13+
apt-get clean && rm -rf /var/lib/apt/lists/*
1414

1515
# Install pyenv
1616
RUN curl https://pyenv.run | bash
@@ -26,7 +26,7 @@ ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
2626
RUN apt-get update && apt-get install -y --no-install-recommends \
2727
autoconf automake build-essential cmake git-core libtool pkg-config wget \
2828
nasm yasm zlib1g-dev libpng-dev libx264-dev libopus-dev libfdk-aac-dev && \
29-
rm -rf /var/lib/apt/lists/*
29+
apt-get clean && rm -rf /var/lib/apt/lists/*
3030

3131
# Set up environment variables
3232
ENV NV_CODEC_HEADERS=/usr/local/cuda/include/ffnvcodec/
@@ -37,10 +37,9 @@ RUN git clone -b n12.2.72.0 --depth 1 https://git.videolan.org/git/ffmpeg/nv-cod
3737
cd .. && rm -rf nv-codec-headers
3838

3939
# Clone the FFmpeg repository and checkout the latest release
40-
RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg
41-
42-
# Build FFmpeg with static linking and the desired hardware-accelerated features
43-
RUN cd ffmpeg && \
40+
RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg && \
41+
# Build FFmpeg with static linking and the desired hardware-accelerated features
42+
cd ffmpeg && \
4443
./configure --prefix=/compiled \
4544
--extra-cflags="-I/ffmpeg_build/include -I/usr/local/cuda/include" \
4645
--extra-ldflags="-L/ffmpeg_build/lib -L/usr/local/cuda/lib64" \
@@ -61,10 +60,8 @@ RUN cd ffmpeg && \
6160
--disable-doc && \
6261
make -j$(nproc) && \
6362
make install && \
64-
make distclean
65-
66-
# Copy the compiled FFmpeg binaries to /usr/local
67-
RUN cp -R /compiled/* /usr/local/
68-
69-
# Clean up APT cache to reduce image size
70-
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
63+
make distclean && \
64+
# Copy the compiled FFmpeg binaries to /usr/local
65+
cp -R /compiled/* /usr/local/ && \
66+
cd .. \
67+
rm -rf ffmpeg

runner/docker/Dockerfile.live-base-comfyui

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get update && \
1414
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
1515
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
1616
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git runit libzmq3-dev && \
17-
rm -rf /var/lib/apt/lists/*
17+
apt-get clean && rm -rf /var/lib/apt/lists/*
1818

1919
# Keep python installation from base image
2020

@@ -23,7 +23,7 @@ RUN apt-get update && \
2323
RUN apt-get update && apt-get install -y --no-install-recommends \
2424
autoconf automake build-essential cmake git-core libtool pkg-config wget \
2525
nasm yasm zlib1g-dev libpng-dev libx264-dev libopus-dev libfdk-aac-dev && \
26-
rm -rf /var/lib/apt/lists/*
26+
apt-get clean && rm -rf /var/lib/apt/lists/*
2727

2828
# Set up environment variables
2929
ENV NV_CODEC_HEADERS=/usr/local/cuda/include/ffnvcodec/
@@ -34,10 +34,9 @@ RUN git clone -b n12.2.72.0 --depth 1 https://git.videolan.org/git/ffmpeg/nv-cod
3434
cd .. && rm -rf nv-codec-headers
3535

3636
# Clone the FFmpeg repository and checkout the latest release
37-
RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg
38-
39-
# Build FFmpeg with shared libraries and hardware acceleration
40-
RUN cd ffmpeg && \
37+
RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg && \
38+
# Build FFmpeg with static linking and the desired hardware-accelerated features
39+
cd ffmpeg && \
4140
./configure --prefix=/compiled \
4241
--extra-cflags="-I/ffmpeg_build/include -I/usr/local/cuda/include" \
4342
--extra-ldflags="-L/ffmpeg_build/lib -L/usr/local/cuda/lib64" \
@@ -58,13 +57,11 @@ RUN cd ffmpeg && \
5857
--disable-doc && \
5958
make -j$(nproc) && \
6059
make install && \
61-
make distclean
62-
63-
# Copy the compiled FFmpeg binaries to /usr/local
64-
RUN cp -R /compiled/* /usr/local/
65-
66-
# Clean up APT cache to reduce image size
67-
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
60+
make distclean && \
61+
# Copy the compiled FFmpeg binaries to /usr/local
62+
cp -R /compiled/* /usr/local/ && \
63+
cd .. \
64+
rm -rf ffmpeg
6865

6966
# -----------------------------------------------------------------------------
7067
# live-base: End of section

0 commit comments

Comments
 (0)