Skip to content

Conversation

@pjonsson
Copy link
Contributor

Put the build of OpenCV in a build container. It doesn't look very clear from the GitHub diffview, but there are basically 3 separate changes in this PR:

  1. Move the previous build parts into a build container and copy the built library into the image
  2. Switch the OpenCV build to using Ninja, which is slightly faster than make, and well-supported by CMake
  3. Use the Dockerfile ADD instruction for downloading the OpenCV source archive. This makes it easy to perform checksum validation to protect against supply-chain attacks, and as a side benefit it also makes the source archive reside in the Docker cache which speeds up local builds.

Besides the security and build time improvements, this is a step on the way towards being able to reduce the size of the image.

Put the package installation in
the internal_base image. This
will enable building OpenCV
in a build container, which
in the long run will enable
us to make the image smaller.
Build OpenCV in a separate build container
and copy the built files into the final
container. This means we can just build
and install without having to worry
about cleaning up the build files.
This also creates a separate layer
for OpenCV, so that will hit the Docker
cache more frequently.

Also switch to using Ninja while changing
things. Ninja is similar to make, but
is slightly faster and will use
all cores automatically.
This will prevent the container to
build if someone manages to replace
the OpenCV source archive.

As a side effect, this will also
cache the archive in the Docker
cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant