chg: Nicer multi-arch builds and also add armv7

This commit is contained in:
Sayantan Santra 2024-03-25 00:56:39 -05:00
parent 2baa481040
commit 82559d38fd
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
3 changed files with 17 additions and 12 deletions

View File

@ -1,8 +0,0 @@
FROM scratch
ARG TARGETARCH
COPY .docker/$TARGETARCH/chhoto-url /chhoto-url
COPY ./resources /resources
ENTRYPOINT ["/chhoto-url"]

View File

@ -0,0 +1,15 @@
FROM scratch as builder-amd64
COPY ./actix/target/x86_64-unknown-linux-musl/release/chhoto-url /chhoto-url
FROM scratch as builder-arm64
COPY ./actix/target/aarch64-unknown-linux-musl/release/chhoto-url /chhoto-url
FROM scratch as builder-arm
COPY ./actix/target/armv7-unknown-linux-musleabihf/release/chhoto-url /chhoto-url
ARG TARGETARCH
FROM builder-$TARGETARCH
COPY ./resources /resources
ENTRYPOINT ["/chhoto-url"]

View File

@ -5,13 +5,11 @@ setup:
build:
cross build --release --locked --manifest-path=actix/Cargo.toml --target aarch64-unknown-linux-musl
cross build --release --locked --manifest-path=actix/Cargo.toml --target armv7-unknown-linux-musleabihf
cross build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
docker: build
mkdir -p .docker/amd64 .docker/arm64
cp actix/target/aarch64-unknown-linux-musl/release/chhoto-url .docker/arm64/
cp actix/target/x86_64-unknown-linux-musl/release/chhoto-url .docker/amd64/
docker buildx build --push --tag sintan1729/chhoto-url:dev --platform linux/amd64,linux/arm64 .
docker buildx build --push --tag sintan1729/chhoto-url:dev --platform linux/amd64,linux/arm64,linux/arm/v7 .
clean:
cargo clean --manifest-path=actix/Cargo.toml