Getting started with Bazel Docker Container

In this guide, we will explore the contents of the Bazel container, build the
abseil-cpp project using Bazel inside
the Bazel container, as well as build the
abseil-cpp project directly from the
host machine using the Bazel container with directory mounting.

Build Abseil project from your host machine with directory mounting

The instructions in this section allow you to build using the Bazel container
with the sources checked out in your host environment. A container is started up
for each build command you execute. Build results are cached in your host
environment so they can be reused across builds.

Clone the project to a directory in your host machine.

git clone https://github.com/abseil/abseil-cpp.git /src/workspace

Create a folder that will have cached results to be shared across builds.

mkdir -p /tmp/build_output/

Use the Bazel container to build the project and make the build
outputs available in the output folder in your host machine.

Build Abseil project from inside the container

The instructions in this section allow you to build using the Bazel container
with the sources checked out inside the container. A container is started up at
the beginning of your dev workflow, and all changes to sources must be done
inside the container. Build results are cached only inside the container and
will be lost once container is stopped.