# Stage 1: Build the x86_64-linux image FROM nixos/nix:2.24.11 as builder # Set up environment ENV LANG=en_US.UTF-8 \ NIX_PATH=nixpkgs=channel:nixos-unstable \ PATH=/root/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin # Copy the flake configuration WORKDIR /workspace COPY . /workspace # Build the Docker image specified in the Nix flake RUN nix \ --extra-experimental-features "nix-command flakes" \ --option filter-syscalls false \ build .#packages.x86_64-linux.build-image -o result # Stage 2: Create the final runtime image FROM scratch # Copy the built image from the builder stage COPY --from=builder /workspace/result /workspace/result # Set the default command CMD ["/bin/bash"]