docker: Switch a glibc-based build

Similar to what was done for the pre-built binaries
This commit is contained in:
Quentin Gliech
2024-03-25 10:05:04 +01:00
parent 6918b5531b
commit c28348f254

View File

@@ -93,8 +93,8 @@ RUN --network=default \
RUN --network=default \ RUN --network=default \
rustup target add \ rustup target add \
--toolchain "${RUSTC_VERSION}" \ --toolchain "${RUSTC_VERSION}" \
x86_64-unknown-linux-musl \ x86_64-unknown-linux-gnu \
aarch64-unknown-linux-musl aarch64-unknown-linux-gnu
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
@@ -124,8 +124,8 @@ RUN --network=default \
--recipe-path recipe.json \ --recipe-path recipe.json \
--no-default-features \ --no-default-features \
--features docker \ --features docker \
--target x86_64-unknown-linux-musl \ --target x86_64-unknown-linux-gnu \
--target aarch64-unknown-linux-musl \ --target aarch64-unknown-linux-gnu \
--package mas-cli --package mas-cli
# Build the rest # Build the rest
@@ -140,14 +140,14 @@ RUN --network=default \
--bin mas-cli \ --bin mas-cli \
--no-default-features \ --no-default-features \
--features docker \ --features docker \
--target x86_64-unknown-linux-musl \ --target x86_64-unknown-linux-gnu \
--target aarch64-unknown-linux-musl --target aarch64-unknown-linux-gnu
# Move the binary to avoid having to guess its name in the next stage # Move the binary to avoid having to guess its name in the next stage
RUN --network=none \ RUN --network=none \
mv "target/x86_64-unknown-linux-musl/release/mas-cli" /usr/local/bin/mas-cli-amd64 mv "target/x86_64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-amd64
RUN --network=none \ RUN --network=none \
mv "target/aarch64-unknown-linux-musl/release/mas-cli" /usr/local/bin/mas-cli-arm64 mv "target/aarch64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-arm64
####################################### #######################################
## Prepare /usr/local/share/mas-cli/ ## ## Prepare /usr/local/share/mas-cli/ ##
@@ -162,7 +162,7 @@ COPY ./translations/ /share/translations
################################## ##################################
## Runtime stage, debug variant ## ## Runtime stage, debug variant ##
################################## ##################################
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:debug-nonroot AS debug FROM --platform=${TARGETPLATFORM} gcr.io/distroless/base-nossl-debian${DEBIAN_VERSION}:debug-nonroot AS debug
ARG TARGETARCH ARG TARGETARCH
COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli
@@ -174,7 +174,7 @@ ENTRYPOINT ["/usr/local/bin/mas-cli"]
################### ###################
## Runtime stage ## ## Runtime stage ##
################### ###################
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:nonroot FROM --platform=${TARGETPLATFORM} gcr.io/distroless/base-nossl-debian${DEBIAN_VERSION}:nonroot
ARG TARGETARCH ARG TARGETARCH
COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli