Initial import into git
This commit is contained in:
commit
54b88801a1
|
@ -0,0 +1,18 @@
|
|||
FROM docker.io/rust:bullseye
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y g++-arm-linux-gnueabihf libc6-dev-armhf-cross
|
||||
# Uncomment if you need to add more build dependencies to the image:
|
||||
# RUN apt-get install -y <build-depend..>
|
||||
|
||||
RUN rustup target add armv7-unknown-linux-gnueabihf
|
||||
RUN rustup toolchain install stable-armv7-unknown-linux-gnueabihf
|
||||
RUN cargo install cargo-deb
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
|
||||
CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
|
||||
CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
|
||||
|
||||
CMD ["cargo", "deb", "--target", "armv7-unknown-linux-gnueabihf"]
|
|
@ -0,0 +1,18 @@
|
|||
FROM docker.io/rust:bullseye
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
|
||||
# Uncomment if you need to add more build dependencies to the image:
|
||||
# RUN apt-get install -y <build-depend..>
|
||||
|
||||
RUN rustup target add aarch64-unknown-linux-gnu
|
||||
RUN rustup toolchain install stable-aarch64-unknown-linux-gnu
|
||||
RUN cargo install cargo-deb
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
|
||||
|
||||
CMD ["cargo", "deb", "--target", "aarch64-unknown-linux-gnu"]
|
|
@ -0,0 +1,11 @@
|
|||
FROM docker.io/rust:bullseye
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
# Uncomment if you need to add more build dependencies to the image:
|
||||
# RUN apt-get install -y <build-depend..>
|
||||
|
||||
RUN cargo install cargo-deb
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["cargo", "deb"]
|
|
@ -0,0 +1,74 @@
|
|||
# Docker files for cross-builds using cargo-deb
|
||||
|
||||
These files allows you to build Debian packages for the (Debian) architectures
|
||||
i686, armhf and arm64 using an amd64 system.
|
||||
|
||||
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.
|
||||
|
||||
## Cross-compile to i686
|
||||
|
||||
Build the image:
|
||||
|
||||
```console
|
||||
$ docker build . -t cargo-deb-crossbuild/i686 --platform linux/386 -f Dockerfile
|
||||
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/i686
|
||||
...
|
||||
/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
|
||||
$ docker build . -t cargo-deb-crossbuild/arm64 --platform linux/arm64/v8 -f Dockerfile
|
||||
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
|
||||
$ docker build . -t cargo-deb-crossbuild/armhf --platform linux/arm/v7 -f Dockerfile
|
||||
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`.
|
Loading…
Reference in New Issue