v0.14.20
This commit is contained in:
+27
-11
@@ -9,17 +9,28 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
||||
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-trixie AS builder-trixie
|
||||
COPY --from=xx / /
|
||||
WORKDIR /src
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends clang lld llvm file pkg-config
|
||||
ARG TARGETPLATFORM
|
||||
RUN xx-apt-get update \
|
||||
&& xx-apt-get install -y --no-install-recommends xx-c-essentials \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& xx-cargo --version >/dev/null
|
||||
&& apt-get install -y --no-install-recommends clang lld llvm file pkg-config \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Fetch Rust dependencies before TARGETPLATFORM enters the cache chain, so the
|
||||
# same registry/git cache is reused by amd64 and arm64 builds.
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN --mount=type=cache,id=gree-controller-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=gree-controller-cargo-git,target=/usr/local/cargo/git \
|
||||
cargo fetch --locked
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETARCH
|
||||
# Prepare the target C sysroot and Rust stdlib in a stable layer. Do not call
|
||||
# the xx-cargo version probe: xx-cargo is a build wrapper and that invocation
|
||||
# makes Cargo receive a target option without a subcommand.
|
||||
RUN xx-apt-get update \
|
||||
&& xx-apt-get install -y --no-install-recommends xx-c-essentials \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rustup target add "$(xx-cargo --print-target-triple)"
|
||||
|
||||
COPY build.rs ./
|
||||
COPY src ./src
|
||||
COPY web ./web
|
||||
@@ -28,7 +39,7 @@ COPY presets ./presets
|
||||
COPY docs/openapi.json ./docs/openapi.json
|
||||
RUN --mount=type=cache,id=gree-controller-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=gree-controller-cargo-git,target=/usr/local/cargo/git \
|
||||
--mount=type=cache,id=gree-controller-target-trixie,target=/src/target \
|
||||
--mount=type=cache,id=gree-controller-target-trixie-${TARGETARCH},target=/src/target \
|
||||
set -eux; \
|
||||
xx-cargo build --locked --release --target-dir /src/target; \
|
||||
binary="/src/target/$(xx-cargo --print-target-triple)/release/gree-controller"; \
|
||||
@@ -40,13 +51,18 @@ FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-alpine AS builder-alpine
|
||||
COPY --from=xx / /
|
||||
WORKDIR /src
|
||||
RUN apk add --no-cache clang lld llvm file pkgconf
|
||||
ARG TARGETPLATFORM
|
||||
RUN xx-apk add --no-cache xx-c-essentials \
|
||||
&& xx-cargo --version >/dev/null
|
||||
|
||||
# Keep dependency fetching architecture-independent here as well.
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN --mount=type=cache,id=gree-controller-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=gree-controller-cargo-git,target=/usr/local/cargo/git \
|
||||
cargo fetch --locked
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETARCH
|
||||
RUN xx-apk add --no-cache xx-c-essentials \
|
||||
&& rustup target add "$(xx-cargo --print-target-triple)"
|
||||
|
||||
COPY build.rs ./
|
||||
COPY src ./src
|
||||
COPY web ./web
|
||||
@@ -55,7 +71,7 @@ COPY presets ./presets
|
||||
COPY docs/openapi.json ./docs/openapi.json
|
||||
RUN --mount=type=cache,id=gree-controller-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=gree-controller-cargo-git,target=/usr/local/cargo/git \
|
||||
--mount=type=cache,id=gree-controller-target-alpine,target=/src/target \
|
||||
--mount=type=cache,id=gree-controller-target-alpine-${TARGETARCH},target=/src/target \
|
||||
set -eux; \
|
||||
xx-cargo build --locked --release --target-dir /src/target; \
|
||||
binary="/src/target/$(xx-cargo --print-target-triple)/release/gree-controller"; \
|
||||
|
||||
Reference in New Issue
Block a user