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