Sign inSign up

trisetra/python3.10-scip

By trisetra

•Updated almost 2 years ago

Python 3.10 with SCIP optimizer base image

Image
Data science
0

120

trisetra/python3.10-scip repository overview

⁠Python 3.10 with SCIP optimizer base image

# Build Stage
FROM --platform=$BUILDPLATFORM python:3.10-slim AS builder

# Define ARGs
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG SCIP_VERSION=9.1.1
ARG DEBIAN_FRONTEND=noninteractive

# Print platform info for debugging
RUN echo "Building on $BUILDPLATFORM, targeting $TARGETPLATFORM"

# Install build dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y --no-install-recommends \
        wget \
        cmake \
        g++ \
        make \
        m4 \
        xz-utils \
        libcurl4-openssl-dev \
        libgmp-dev \
        unzip \
        zlib1g-dev \
        libboost-program-options-dev \
        libboost-serialization-dev \
        libboost-regex-dev \
        libboost-iostreams-dev \
        libtbb-dev \
        libreadline-dev \
        pkg-config \
        git \
        liblapack-dev \
        libgsl-dev \
        flex \
        bison \
        libcliquer-dev \
        gfortran \
        file \
        dpkg-dev \
        libopenblas-dev \
        rpm

# Build and install SCIP
RUN wget https://www.scipopt.org/download/release/scip-${SCIP_VERSION}.tgz && \
    tar xf scip-${SCIP_VERSION}.tgz && \
    cd scip-${SCIP_VERSION} && \
    mkdir build && \
    cd build && \
    cmake -DAUTOBUILD=on -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .. && \
    make -j$(nproc) && \
    make install && \
    cd ../.. && \
    rm -rf scip-${SCIP_VERSION} scip-${SCIP_VERSION}.tgz

# Runtime Stage
FROM --platform=$TARGETPLATFORM python:3.10-slim AS runtime

# Install runtime dependencies only
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        libgmp10 \
        zlib1g \
        libboost-program-options-dev \
        libboost-serialization-dev \
        libboost-regex-dev \
        libboost-iostreams-dev \
        libtbb-dev \
        libreadline-dev \
        liblapack-dev \
        libgsl-dev \
        libcliquer-dev \
        libopenblas-dev && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy SCIP installation from builder
COPY --from=builder /usr/lib/libscip* /usr/lib/
COPY --from=builder /usr/include/scip /usr/include/scip
RUN ldconfig

# Upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip \
    python3.10 -m pip install --no-cache-dir --upgrade pip

# Set working directory
WORKDIR /app

# Label the image
LABEL org.opencontainers.image.description="Python 3.10 with SCIP optimizer base image" \
      org.opencontainers.image.licenses="MIT"

Tag summary

Content type

Image

Digest

sha256:4997713ea…

Size

165.2 MB

Last updated

almost 2 years ago

docker pull trisetra/python3.10-scip