| 12345678910111213141516171819202122232425262728293031323334353637383940 | # Use the official NixOS image as the base imageFROM nixos/nix:latest AS builder# Set the working directoryWORKDIR /usr/src/app# Copy workspace files and crates directory into the containerCOPY flake.nix ./flake.nixCOPY Cargo.toml ./Cargo.tomlCOPY crates ./crates# Start the Nix daemon and develop the environmentRUN nix develop --extra-experimental-features nix-command --extra-experimental-features flakes --command cargo build --release --bin cdk-mintd# Create a runtime stageFROM debian:bookworm-slim# Set the working directoryWORKDIR /usr/src/app# Install needed runtime dependencies (if any)RUN apt-get update && \    apt-get install -y --no-install-recommends patchelf && \    rm -rf /var/lib/apt/lists/*# Copy the built application from the build stageCOPY --from=builder /usr/src/app/target/release/cdk-mintd /usr/local/bin/cdk-mintd# Detect the architecture and set the interpreter accordinglyRUN ARCH=$(uname -m) && \    if [ "$ARCH" = "aarch64" ]; then \        patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /usr/local/bin/cdk-mintd; \    elif [ "$ARCH" = "x86_64" ]; then \        patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 /usr/local/bin/cdk-mintd; \    else \        echo "Unsupported architecture: $ARCH"; exit 1; \    fi# Set the entry point for the containerCMD ["cdk-mintd"]
 |