Skip to content

Commit

Permalink
Stop adding package source code into the release Docker images
Browse files Browse the repository at this point in the history
The policy that mandated this is no longer relevant now that CVAT is no longer
developed by Intel. Moreover, the source code included was not even complete
(it didn't contain Python or NPM packages).

This saves ~1.6 GB in the unpacked image (and probably a bunch of build time
too, but I didn't measure it).
  • Loading branch information
SpecLad committed Apr 18, 2023
1 parent 1c753d5 commit e855804
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- name: Build images
run: |
CVAT_VERSION=latest CLAM_AV=yes INSTALL_SOURCES=yes docker compose -f docker-compose.yml -f docker-compose.dev.yml build
CVAT_VERSION=latest CLAM_AV=yes docker compose -f docker-compose.yml -f docker-compose.dev.yml build
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand Down
25 changes: 3 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ ENV FFMPEG_VERSION=4.3.1 \
OPENH264_VERSION=2.1.1

WORKDIR /tmp/openh264
RUN curl -sL https://github.com/cisco/openh264/archive/v${OPENH264_VERSION}.tar.gz --output openh264-${OPENH264_VERSION}.tar.gz && \
tar -zx --strip-components=1 -f openh264-${OPENH264_VERSION}.tar.gz && \
RUN curl -sL https://github.com/cisco/openh264/archive/v${OPENH264_VERSION}.tar.gz --output - | \
tar -zx --strip-components=1 && \
make -j5 && make install-shared PREFIX=${PREFIX} && make clean

WORKDIR /tmp/ffmpeg
RUN curl -sL https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 --output - | \
tar -jx --strip-components=1 && \
./configure --disable-nonfree --disable-gpl --enable-libopenh264 \
--enable-shared --disable-static --disable-doc --disable-programs --prefix="${PREFIX}" && \
# make clean keeps the configuration files that let to know how the original sources were used to create the binary
make -j5 && make install && make clean && \
tar -zcf "/tmp/ffmpeg-$FFMPEG_VERSION.tar.gz" . && mv "/tmp/ffmpeg-$FFMPEG_VERSION.tar.gz" .
make -j5 && make install && make clean

# Build wheels for all dependencies
ARG PIP_VERSION
Expand Down Expand Up @@ -125,23 +123,6 @@ RUN if [ "$CLAM_AV" = "yes" ]; then \
rm -rf /var/lib/apt/lists/*; \
fi

ARG INSTALL_SOURCES='no'
WORKDIR ${HOME}/sources
RUN if [ "$INSTALL_SOURCES" = "yes" ]; then \
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list && \
apt-get update && \
dpkg --get-selections | while read -r line; do \
package=$(echo "$line" | awk '{print $1}'); \
mkdir "$package"; \
( \
cd "$package"; \
apt-get -q --download-only source "$package"; \
) \
done && \
rm -rf /var/lib/apt/lists/*; \
fi
COPY --from=build-image /tmp/openh264/openh264*.tar.gz /tmp/ffmpeg/ffmpeg*.tar.gz ${HOME}/sources/

# Install wheels from the build image
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
Expand Down
1 change: 0 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ services:
https_proxy:
socks_proxy:
CLAM_AV:
INSTALL_SOURCES:
CVAT_DEBUG_ENABLED:
environment:
CVAT_DEBUG_ENABLED: '${CVAT_DEBUG_ENABLED:-no}'
Expand Down

0 comments on commit e855804

Please sign in to comment.