From 94f52ea98e2d056507da2b915ff1251d1d3eb7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 7 Apr 2022 22:07:59 +0200 Subject: [PATCH] update readme --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ff5700371..22c03a2b5 100644 --- a/README.md +++ b/README.md @@ -109,10 +109,23 @@ the default one. Normal Docker behavior applies, so: - If only `tag` is omitted, then Docker will use the `latest` tag. +#### Dockerfiles + +If you're using a custom Dockerfile, you can use `target.{{TARGET}}.dockerfile` to automatically build it + +``` toml +[target.aarch64-unknown-linux-gnu.dockerfile] +dockerfile = "./path/to/where/the/Dockerfile/resides" +``` + +`cross` will build and use the image that was built instead of the default image. If `target.{{TARGET}}.image` has been +set, `cross` will name the image, otherwise it will build it as an untagged image. + It's recommended to base your custom image on the default Docker image that cross uses: `ghcr.io/cross-rs/{{TARGET}}:{{VERSION}}` (where `{{VERSION}}` is cross's version). This way you won't have to figure out how to install a cross C toolchain in your -custom image. Example below: +custom image. + ``` Dockerfile FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:latest @@ -122,8 +135,14 @@ RUN dpkg --add-architecture arm64 && \ apt-get install --assume-yes libfoo:arm64 ``` -``` -$ docker build -t my/image:tag path/to/where/the/Dockerfile/resides +#### Pre-build hook + +`cross` enables you to add dependencies and run other necessary commands in the image before using it. +This action will be added to the used image, so it won't be run every time you use `cross`. + +``` toml +[target.x86_64-unknown-linux-gnu] +pre-build = ["yum update", "yum install -y libfoo"] ``` ### Docker in Docker