File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,27 @@ jobs:
3636 - uses : actions/checkout@v4
3737 - name : Set up Docker Buildx
3838 uses : docker/setup-buildx-action@v3
39+ with :
40+ driver-opts : |
41+ image=moby/buildkit:master
42+ - name : Cache Docker layers
43+ uses : actions/cache@v4
44+ with :
45+ path : /tmp/.buildx-cache
46+ key : ${{ runner.os }}-buildx-${{ github.sha }}
47+ restore-keys : |
48+ ${{ runner.os }}-buildx-
3949 - name : Build and push Docker image
4050 uses : docker/build-push-action@v5
51+ with :
52+ cache-from : type=local,src=/tmp/.buildx-cache
53+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
4154 with :
4255 platforms : linux/amd64,linux/arm64
4356 push : false
4457 tags : |
4558 cybuerg/cfspeedtest:${{ github.sha }}
59+ - name : Move cache
60+ run : |
61+ rm -rf /tmp/.buildx-cache
62+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Original file line number Diff line number Diff line change 11FROM rust:slim-bullseye as builder
22WORKDIR /usr/src/cfspeedtest
3+
4+ # Add cross-compilation support
5+ ARG TARGETPLATFORM
6+ RUN echo "Building for $TARGETPLATFORM" && \
7+ if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
8+ apt-get update && \
9+ apt-get install -y --no-install-recommends \
10+ gcc-aarch64-linux-gnu \
11+ binutils-aarch64-linux-gnu && \
12+ rustup target add aarch64-unknown-linux-gnu && \
13+ rm -rf /var/lib/apt/lists/*; \
14+ fi
15+
316COPY Cargo.toml Cargo.lock ./
417COPY src ./src
5- RUN cargo install --path .
18+
19+ # Set up cross-compilation environment
20+ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
21+ ARG CARGO_BUILD_FLAGS=""
22+ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then export CARGO_BUILD_FLAGS="--target aarch64-unknown-linux-gnu" ; fi && \
23+ cargo install --path . $CARGO_BUILD_FLAGS
624
725FROM debian:bullseye-slim
826RUN apt-get update && apt-get install -y --no-install-recommends tini && rm -rf /var/lib/apt/lists/*
You can’t perform that action at this time.
0 commit comments