docs/custom_images.md
Custom images generated from config dockerfile or pre-build keys will
export CROSS_DEB_ARCH, which allows you to install packages from
Ubuntu/Debian repositories without having to specify the exact architecture.
You can find an
example of this here.
cross provides default Docker images for the targets listed in the
README. However, it can't cover every single
use case out there.
If you simply need to install a dependency availaible in ubuntus package
manager, see target.TARGET.pre-build:
[target.x86_64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH"
]
For FreeBSD targets, a few helper scripts are available for use in
target.TARGET.pre-build:
[target.x86_64-unknown-freebsd]
pre-build = ["""
export FREEBSD_MIRROR=$(/freebsd-fetch-best-mirror.sh) &&
/freebsd-setup-packagesite.sh &&
/freebsd-install-package.sh xen-tools
"""]
For other targets, or when the default image is not enough, you can use the
target.{{TARGET}}.dockerfile field
in Cross.toml to use a custom Docker image for a specific target:
NOTE: Refer to the
build.dockerfilesection of the configuration for tips when writing your ownDockerfile.
[target.aarch64-unknown-linux-gnu]
dockerfile = "Dockerfile"
cross will build and use the image that was built instead of the default
image.
If there is a pre-built image for your specific target, you can use the
target.{{TARGET}}.image field in Cross.toml to use
that instead:
[target.aarch64-unknown-linux-gnu]
image = "my/image:tag"
In thie case, cross will use a image named my/image:tag instead of the
default one. Normal Docker behavior applies, so:
my/image:tagimage:tag is specified, then Docker won't look in Docker Hub.tag is omitted, then Docker will use the latest tag.