Skip to content

Conversation

@lia-viam
Copy link
Collaborator

This implements a minimal proof of concept version of docker containers for module development. The old images have been moved to a base-images directory, and now the Dockerfile.sdk-build can be used off an existing build of a base image.

This is validated by the changes to the test.yml workflow, removing the duplicated dockerfile we used to use.

@lia-viam lia-viam requested a review from stuqdog October 25, 2024 17:10
@lia-viam lia-viam requested a review from a team as a code owner October 25, 2024 17:10
@lia-viam lia-viam requested review from jckras and removed request for a team October 25, 2024 17:10
Copy link
Member

@jckras jckras left a comment

Choose a reason for hiding this comment

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

I am still learning about docker and development environments so I left a few questions for my own understanding. Otherwise LGTM

run: |
docker build -t cpp . -f etc/docker/tests/Dockerfile.debian.bullseye
docker run -e BUILD_SHARED=${{ matrix.BUILD_SHARED }} --rm -i -w /tmp cpp /bin/bash
docker build -t cpp . -f etc/docker/base-images/Dockerfile.debian.bullseye
Copy link
Member

Choose a reason for hiding this comment

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

is this creating a base image if you don't already have one? otherwise what is this docker build doing compared to the one below it/why do we need two?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah this is creating the base image which the step below then uses to build the SDK. The idea is to have a modular, many-to-one type scenario where we can have a bunch of base images (the ones in base-images) which, if built, can then be used as input to a single "build the sdk on top of a base" image. from what I found researching this requires having stuff in separate Dockerfiles which are in turn built with separate invocations of docker build

@@ -0,0 +1,47 @@
# This Dockerfile is meant to be built on top of an existing image from the base-images directory.
# Suggested usage, from the SDK root:
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I understand correctly but "Suggested commands to build and run from the SDK root" might be more clear here?

Comment on lines +37 to +43
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED} \
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
-DVIAMCPPSDK_BUILD_TESTS=${BUILD_TESTS} \
-DVIAMCPPSDK_BUILD_EXAMPLES=${BUILD_EXAMPLES} \
${EXTRA_CMAKE_ARGS}
Copy link
Member

Choose a reason for hiding this comment

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

why are we setting this build flags here instead of the run.sh file like before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so it used to be that CI ran tests by using a separate Dockerfile (the deleted one) which copy-pasted everything from the Dockerfile.debian.bullseye but with the addition of an ENTRYPOINT to run_test.sh, but really what that script was doing was like build_the_sdk_and_run_test. So with this PR we have a Dockerfile which now takes care of the build_the_sdk part, and it can use the existing Dockerfile.debian.bullseye without needing the duplicated one

ninja all
ninja install
INSTALL_DIR="$(pwd)/install"
BUILD_SHARED=$(grep 'BUILD_SHARED_LIBS' CMakeCache.txt | cut -d '=' -f 2)
Copy link
Member

Choose a reason for hiding this comment

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

are we adding this line because of the other shared library changes in #309 that are happening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no not super related except to the extent that this is part of the ongoing saga of having shared/static builds properly supported :) but in particular this script is building with CMake rather than Conan so it already works properly

@lia-viam lia-viam requested a review from njooma October 28, 2024 13:46
Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

I think this is a great starting point. Eventually, we might want to release our base tags online so that the end user doesn't have to build it themselves ahead of time.

@lia-viam lia-viam merged commit d4a6e52 into viamrobotics:main Oct 29, 2024
4 checks passed
@lia-viam lia-viam deleted the feature/docker-module-dev branch October 29, 2024 17:32
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.

3 participants