From 25885b8e08252db20f2a50e64184b6a59e546a73 Mon Sep 17 00:00:00 2001 From: fx Date: Fri, 13 Oct 2023 15:26:05 +0200 Subject: stuff --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/test.yml') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1bfdf7..bf170f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,4 +54,4 @@ jobs: push: true tags: | ghcr.io/fxqnlr/webol:dev-latest - ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} \ No newline at end of file + ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} -- cgit v1.2.3 From d109f789b1cb75fc144a203628694dfb7ed300cb Mon Sep 17 00:00:00 2001 From: fx Date: Sat, 14 Oct 2023 23:14:09 +0200 Subject: test multiplatform build w/ actions --- .github/workflows/test.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to '.github/workflows/test.yml') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf170f5..ed9fba6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: build on: push: - branches: [ "main" ] + branches: [ "main", "test" ] pull_request: - branches: [ "main" ] + branches: [ "main", "test" ] workflow_dispatch: env: @@ -12,7 +12,6 @@ env: RUSTC_WRAPPER: "sccache" SQLX_OFFLINE: "true" CARGO_TERM_COLOR: always - CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc jobs: build: @@ -21,23 +20,25 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable - target: armv7-unknown-linux-gnueabihf components: rustfmt, clippy override: true - - name: Install arm linker - run: sudo apt update && sudo apt install gcc-arm-linux-gnueabihf -y + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check - - name: Cargo build + - name: Run Clippy uses: actions-rs/cargo@v1 with: - command: build - args: --release --target armv7-unknown-linux-gnueabihf + command: clippy + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub @@ -50,8 +51,9 @@ jobs: id: docker_build uses: docker/build-push-action@v3 with: - file: Dockerfile + file: Dockerfile.build push: true + platforms: linux/amd64,linux/arm/v7 tags: | - ghcr.io/fxqnlr/webol:dev-latest - ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} + ghcr.io/fxqnlr/webol:test-latest + ghcr.io/fxqnlr/webol:test-${{ github.run_number }} -- cgit v1.2.3 From 0948f75248a5daf8229ce1f40d1b3ec8d9aecbac Mon Sep 17 00:00:00 2001 From: fx Date: Sun, 15 Oct 2023 02:26:29 +0200 Subject: test w/ cargo chef + arm64 --- .github/workflows/test.yml | 7 +++---- Dockerfile | 27 +++++++++++++++++++++++---- Dockerfile.arm.build | 16 ---------------- Dockerfile.build | 18 ------------------ build.rs.disabled | 5 +++++ nobuild.rs.old | 5 ----- 6 files changed, 31 insertions(+), 47 deletions(-) delete mode 100644 Dockerfile.arm.build delete mode 100644 Dockerfile.build create mode 100644 build.rs.disabled delete mode 100644 nobuild.rs.old (limited to '.github/workflows/test.yml') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed9fba6..649f295 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,9 +51,8 @@ jobs: id: docker_build uses: docker/build-push-action@v3 with: - file: Dockerfile.build push: true - platforms: linux/amd64,linux/arm/v7 + platforms: linux/amd64,linux/arm64 tags: | - ghcr.io/fxqnlr/webol:test-latest - ghcr.io/fxqnlr/webol:test-${{ github.run_number }} + ghcr.io/fxqnlr/webol:latest + ghcr.io/fxqnlr/webol:${{ github.run_number }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d014c5a..5757f0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,26 @@ -FROM --platform=amd64 debian:bullseye-slim +FROM debian:bookworm AS deb_extractor +RUN cd /tmp && \ + apt-get update && apt-get download \ + libc6 && \ + mkdir /dpkg && \ + for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done -WORKDIR /usr/local/webol -COPY target/armv7-unknown-linux-gnueabihf/release/webol /usr/local/bin/webol +FROM lukemathwalker/cargo-chef:latest-rust-1.73.0 as chef +WORKDIR app + +FROM chef AS planner +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef as builder +COPY --from=planner /app/recipe.json recipe.json +RUN cargo chef cook --release --recipe-path recipe.json +COPY . . +RUN cargo build --release + +FROM gcr.io/distroless/cc +COPY --from=builder /app/target/release/webol / +COPY --from=deb_extractor /dpkg / EXPOSE 7229 -CMD ["webol"] \ No newline at end of file +ENTRYPOINT ["./webol"] diff --git a/Dockerfile.arm.build b/Dockerfile.arm.build deleted file mode 100644 index 1845afe..0000000 --- a/Dockerfile.arm.build +++ /dev/null @@ -1,16 +0,0 @@ -FROM rust:1.73 as builder -WORKDIR /usr/src/webol -COPY . . -#RUN rustup target add armv7-unknown-linux-gnueabihf -#RUN apt update && apt install gcc-arm-linux-gnueabihf -y -#RUN CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc cargo install --path . --target armv7-unknown-linux-gnueabihf -RUN cargo install --path . - -#FROM --platform=arm64 debian:bookworm-slim -FROM debian:bookworm-slim -RUN apt update && apt install -y libc6 && rm -rf /var/lib/apt/lists/* -WORKDIR /usr/local/webol -COPY --from=builder /usr/local/cargo/bin/webol /usr/local/bin/webol - -EXPOSE 7229 -CMD ["webol"] diff --git a/Dockerfile.build b/Dockerfile.build deleted file mode 100644 index 0158b8a..0000000 --- a/Dockerfile.build +++ /dev/null @@ -1,18 +0,0 @@ -FROM debian:bookworm AS deb_extractor -RUN cd /tmp && \ - apt-get update && apt-get download \ - libc6 && \ - mkdir /dpkg && \ - for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done - -FROM rust:1.73 as builder -WORKDIR /app -COPY . . -RUN cargo build --release - -FROM gcr.io/distroless/cc -COPY --from=builder /app/target/release/webol / -COPY --from=deb_extractor /dpkg / - -EXPOSE 7229 -ENTRYPOINT ["./webol"] diff --git a/build.rs.disabled b/build.rs.disabled new file mode 100644 index 0000000..7609593 --- /dev/null +++ b/build.rs.disabled @@ -0,0 +1,5 @@ +// generated by `sqlx migrate build-script` +fn main() { + // trigger recompilation when a new migration is added + println!("cargo:rerun-if-changed=migrations"); +} \ No newline at end of file diff --git a/nobuild.rs.old b/nobuild.rs.old deleted file mode 100644 index 7609593..0000000 --- a/nobuild.rs.old +++ /dev/null @@ -1,5 +0,0 @@ -// generated by `sqlx migrate build-script` -fn main() { - // trigger recompilation when a new migration is added - println!("cargo:rerun-if-changed=migrations"); -} \ No newline at end of file -- cgit v1.2.3 From 82463cb3c3b107dbeed2b5f2cec0751bdae4b05d Mon Sep 17 00:00:00 2001 From: fx Date: Sun, 15 Oct 2023 14:53:23 +0200 Subject: test with build.rs and cache-to and from --- .github/workflows/test.yml | 8 +++++--- build.rs | 5 +++++ build.rs.disabled | 5 ----- 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 build.rs delete mode 100644 build.rs.disabled (limited to '.github/workflows/test.yml') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 649f295..97a0d2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: push: branches: [ "main", "test" ] pull_request: - branches: [ "main", "test" ] + branches: [ "main" ] workflow_dispatch: env: @@ -53,6 +53,8 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max tags: | - ghcr.io/fxqnlr/webol:latest - ghcr.io/fxqnlr/webol:${{ github.run_number }} \ No newline at end of file + ghcr.io/fxqnlr/webol:dev-latest + ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..7609593 --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +// generated by `sqlx migrate build-script` +fn main() { + // trigger recompilation when a new migration is added + println!("cargo:rerun-if-changed=migrations"); +} \ No newline at end of file diff --git a/build.rs.disabled b/build.rs.disabled deleted file mode 100644 index 7609593..0000000 --- a/build.rs.disabled +++ /dev/null @@ -1,5 +0,0 @@ -// generated by `sqlx migrate build-script` -fn main() { - // trigger recompilation when a new migration is added - println!("cargo:rerun-if-changed=migrations"); -} \ No newline at end of file -- cgit v1.2.3 From bd7ec2d19da0793963a7aab355873758ae4e0601 Mon Sep 17 00:00:00 2001 From: FxQnLr <39925636+FxQnLr@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:51:24 +0200 Subject: Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows/test.yml') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97a0d2f..90a5fea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: build on: push: - branches: [ "main", "test" ] + branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: @@ -57,4 +57,4 @@ jobs: cache-to: type=gha,mode=max tags: | ghcr.io/fxqnlr/webol:dev-latest - ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} \ No newline at end of file + ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} -- cgit v1.2.3