2023-01-01 13:08:11 +01:00
|
|
|
# Docker files for cross-builds using cargo-deb
|
|
|
|
|
|
|
|
These files allows you to build Debian packages for the (Debian) architectures
|
2023-01-01 13:55:33 +01:00
|
|
|
i386, armhf and arm64 using an amd64 host system.
|
2023-01-01 13:08:11 +01:00
|
|
|
|
|
|
|
Note that the `Dockerfile`s use the full Rust Debian Buster Docker image and
|
|
|
|
not the slim version so that some common build-dependencies (such as
|
|
|
|
`libssl-dev`) are already present.
|
|
|
|
|
2023-01-01 13:55:33 +01:00
|
|
|
## Cross-compile to i386
|
2023-01-01 13:08:11 +01:00
|
|
|
|
|
|
|
Build the image:
|
|
|
|
|
|
|
|
```console
|
2023-03-24 14:30:43 +01:00
|
|
|
$ docker build . -t cargo-deb-crossbuild/i386 --platform linux/386 -f Dockerfile.i386
|
2023-01-01 13:08:11 +01:00
|
|
|
STEP 1/5: FROM docker.io/rust:bullseye
|
|
|
|
Trying to pull docker.io/library/rust:bullseye...
|
|
|
|
Getting image source signatures
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
In your Rust project, run:
|
|
|
|
|
|
|
|
```console
|
2023-01-01 13:55:33 +01:00
|
|
|
$ docker run --rm -ti -v `pwd`:/app cargo-deb-crossbuild/i386
|
2023-01-01 13:08:11 +01:00
|
|
|
...
|
|
|
|
/app/target/debian/<your crate>.deb
|
|
|
|
```
|
|
|
|
|
|
|
|
You can find the resulting deb file in `./target/debian`.
|
|
|
|
|
|
|
|
## Cross-compile to arm64 (ARM v8)
|
|
|
|
|
|
|
|
Build the image:
|
|
|
|
|
|
|
|
```console
|
2023-03-24 14:30:43 +01:00
|
|
|
$ docker build . -t cargo-deb-crossbuild/arm64 --platform linux/arm64/v8 -f Dockerfile.arm64
|
2023-01-01 13:08:11 +01:00
|
|
|
STEP 1/5: FROM docker.io/rust:bullseye
|
|
|
|
Trying to pull docker.io/library/rust:bullseye...
|
|
|
|
Getting image source signatures
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
In your Rust project, run:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ docker run --rm -ti -v `pwd`:/app cargo-deb-crossbuild/arm64
|
|
|
|
...
|
|
|
|
/app/target/debian/<your crate>.deb
|
|
|
|
```
|
|
|
|
|
|
|
|
You can find the resulting deb file in `./target/debian`.
|
|
|
|
|
|
|
|
## Cross-compile to armhf (ARM v7)
|
|
|
|
|
|
|
|
Build the image:
|
|
|
|
|
|
|
|
```console
|
2023-03-24 14:30:43 +01:00
|
|
|
$ docker build . -t cargo-deb-crossbuild/armhf --platform linux/arm/v7 -f Dockerfile.armhf
|
2023-01-01 13:08:11 +01:00
|
|
|
STEP 1/5: FROM docker.io/rust:bullseye
|
|
|
|
Trying to pull docker.io/library/rust:bullseye...
|
|
|
|
Getting image source signatures
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
In your Rust project, run:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ docker run --rm -ti -v `pwd`:/app cargo-deb-crossbuild/armhf
|
|
|
|
...
|
|
|
|
/app/target/debian/<your crate>.deb
|
|
|
|
```
|
|
|
|
|
|
|
|
You can find the resulting deb file in `./target/debian`.
|