Created
July 31, 2025 07:15
-
-
Save Dekker1/ef76f34150c2205cb1ef0ba33e61dca0 to your computer and use it in GitHub Desktop.
MiniZinc Challenge Huub Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build in an isolated stage called builder. | |
FROM minizinc/mznc2025:latest AS builder | |
# Install basic tools. | |
RUN apt-get update -y && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential curl git | |
# Install Rust compiler toolchain. | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y | |
ENV PATH="/root/.cargo/bin:${PATH}" | |
# Clone the git repository. | |
WORKDIR /src | |
ARG repo=https://github.com/huub-solver/huub.git | |
ARG branch=develop | |
RUN git clone --branch $branch --single-branch $repo . | |
# Build Huub. | |
RUN cargo build --release | |
# Create our final image using this base. | |
FROM minizinc/mznc2025:latest | |
# Copy the Huub installation to /huub in the final image. | |
COPY --from=builder /src/target/release/huub /huub/bin/huub | |
COPY --from=builder /src/share /huub/share | |
# Add Huub to the MiniZinc search path and set it as the default solver. | |
RUN echo '{"mzn_solver_path": ["/huub/share/minizinc/solvers"],' > $HOME/.minizinc/Preferences.json && \ | |
echo '"tagDefaults": [["", "solutions.huub"]]}' >> $HOME/.minizinc/Preferences.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment