These steps will allow you to compile code as described platform/linux/README.md using a Docker container. All the steps should be executed from the root of the repository.
Important
Not all platform builds are currently supported. Docker builds are a work in progress.
Important
You cannot build MapLibre native using both Docker and host methods at the same time. If you want to switch, you need to clean the repository first, e.g. by using this command:
git clean -dxfi -e .idea -e .clwb -e .vscode
You must build your own Docker image, specific with your user and group IDs to ensure file permissions stay correct.
# Build docker image from the repo __root__
# Specifying USER_UID and USER_GID allows container to create files with the same owner as the host user,
# and avoids having to pass -u $(id -u):$(id -g) to docker run.
docker build \
-t maplibre-native-image \
--build-arg USER_UID=$(id -u) \
--build-arg USER_GID=$(id -g) \
-f docker/Dockerfile \
docker
# Run all build commands using the docker container.
# You can also execute build commands from inside the docker container by starting it without the build command.
docker run --rm -it -v "$PWD:/app/" -v "$PWD/docker/.cache:/home/user/.cache" maplibre-native-image
You can also use the container to run just one specific commands, e.g. cmake
or bazel
. Any downloaded dependencies will be cached in the docker/.cache
directory.
docker run --rm -it -v "$PWD:/app/" -v "$PWD/docker/.cache:/home/user/.cache" maplibre-native-image cmake ...