Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Jun 8, 2022
1 parent 90df1e1 commit 94f52ea
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 94f52ea

Please sign in to comment.