From 82559d38fd194ff1ca8afd80ab17c6678056756e Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 25 Mar 2024 00:56:39 -0500 Subject: [PATCH] chg: Nicer multi-arch builds and also add armv7 --- Dockerfile | 8 -------- Dockerfile-for-push-script | 15 +++++++++++++++ Makefile | 6 ++---- 3 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 Dockerfile create mode 100644 Dockerfile-for-push-script diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8560074..0000000 --- a/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM scratch -ARG TARGETARCH - -COPY .docker/$TARGETARCH/chhoto-url /chhoto-url -COPY ./resources /resources - -ENTRYPOINT ["/chhoto-url"] - diff --git a/Dockerfile-for-push-script b/Dockerfile-for-push-script new file mode 100644 index 0000000..abb460f --- /dev/null +++ b/Dockerfile-for-push-script @@ -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"] + diff --git a/Makefile b/Makefile index 8aa8dac..55480f1 100644 --- a/Makefile +++ b/Makefile @@ -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