@@ -23,24 +23,44 @@ NOTE: Windows is not supported. If you are using Windows, build the project in W
2323
2424## Using Docker for Development
2525
26- A Docker description is included which will install the required
27- packages.
28- 1 . Create a new docker image from one of the provided docker
29- files. From the root directory of this project (where this README
30- is located), run `docker build -t cpp . -f
31- etc/docker/Dockerfile.debian.bullseye` (other files are provided
32- for Ubuntu Focal and Ubuntu Jammy as well as Debian Sid). Run the
33- new image in a container that has your local project directory
34- mounted to the filesystem. This will ensure that you can continue
35- to develop locally on your machine, and all files will be
36- automatically synced into the docker environment. To create the
37- environment and open a shell to it, run the command `docker run
38- --rm -it -v "$PWD":/usr/src/viam-cpp-sdk -w /usr/src/viam-cpp-sdk
39- cpp /bin/bash`
40- 1 . Start developing! You can develop as you normally would, using the
41- files on your local filesystem. When it comes time to
42- testing/building/running the program, do so inside the docker
43- environment you opened in the previous step.
26+ Some Dockerfiles are provided for C++ SDK development, either for developing
27+ on the SDK itself, or for module development. The docker images are split up
28+ into base images, found in [ etc/docker/base-images] ( etc/docker/base-images ) , and
29+ an [ SDK build image] ( etc/docker/Dockerfile.sdk-build ) . The base images install
30+ apt packages required to build and develop the SDK, whereas the SDK build image
31+ is meant to be built on top of a base image using multi-stage Docker building.
32+
33+ From the root of this repository, run
34+ ``` shell
35+ docker build -t base/bullseye -f etc/docker/base-images/Dockerfile.debian.bullseye .
36+ ```
37+ This will create a Debian Bullseye base image. Note the use of the ` -t base/bullseye `
38+ arg to assign a tag to the image, which is important for the next step. You can then
39+ use ` Dockerfile.sdk-build ` in a couple different ways.
40+
41+ ``` shell
42+ docker build --build-arg BASE_TAG=base/bullseye --build-arg GIT_TAG=[...] -f etc/docker/Dockerfile.sdk-build .
43+ ```
44+
45+ This will use ` base/bullseye ` as a base to build the SDK version provided in ` GIT_TAG ` ,
46+ which should be a tagged release version. The SDK will be cloned from
47+ https://github.com/viamrobotics/viam-cpp-sdk/ . This is the recommended approach for
48+ C++ module development, which should generally be done against a tagged release.
49+
50+ You can also do
51+ ``` shell
52+ docker build --build-arg BASE_TAG=base/bullseye --build-arg REPO_SETUP=copy -f etc/docker/Dockerfile.sdk-build .
53+ ```
54+
55+ Note the use of the build argument ` REPO_SETUP=copy ` , which adds a Docker instruction
56+ to copy the SDK repo from the current working directory, rather than cloning from
57+ GitHub. This approach may make more sense for developing on the SDK itself, or if
58+ your C++ SDK development relies on a localversion of the SDK.
59+
60+ The examples above illustrated the use of several ` --build-arg ` arguments, namely
61+ ` BASE_TAG ` , ` GIT_TAG ` , and ` REPO_SETUP ` . Please see
62+ [ Dockerfile.sdk-build] ( etc/docker/Dockerfile.sdk-build ) for a complete account of
63+ all build arguments and their defaults.
4464
4565## Building Documentation Locally for Testing
4666The C++ sdk uses [ Doxygen] ( https://www.doxygen.nl/ ) to generate documentation.
0 commit comments