FROM ubuntu:26.04
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies for building numpy with vendored Meson
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential ninja-build cmake git pkg-config python3-dev python3-pip \
libopenblas-dev gfortran libgfortran5 && \
python3 -m pip install -U pip && \
rm -rf /var/lib/apt/lists/*
# Set workdir to repository root (copied in later step)
WORKDIR /numpy
# Copy source code
COPY . /numpy
# Build from source using vendored Meson (spin is provided by build requirements)
RUN python3 -m pip install -r requirements/build_requirements.txt
# Build the project with the specified Meson options
RUN spin build -- -Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none
# Ensure the built Python package is on PYTHONPATH for runtime usage
ENV PYTHONPATH=/numpy/build-install/lib/python3.12/site-packages:$PYTHONPATH
# Default to an interactive shell
CMD ["/bin/bash"]
# Docker build context exclusions .git .gitignore __pycache__/ *.pyc *.pyo *.pyd venv/ env/ build/ dist/ *.egg-info/ *.eggs/ *.tox/ *.pytest_cache/ *.cache/ .DS_Store # Optional local environment files .env
Concerns: Base image tag ubuntu:26.04 is invalid/not standard and may not exist in Docker Hub., PYTHONPATH points to a hard-coded Python 3.12 site-packages path which may not exist if the image uses a different Python version., Build relies on 'spin' and a requirements/build_requirements.txt that may not be present or available in the repository; this could cause the build to fail.
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies for building numpy with vendored Meson
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential ninja-build cmake git pkg-config python3-dev python3-pip \
libopenblas-dev gfortran libgfortran5 && \
python3 -m pip install -U pip && \
rm -rf /var/lib/apt/lists/*
# Set workdir to repository root (copied in later step)
WORKDIR /numpy
# Copy source code
COPY . /numpy
# Build from source using vendored Meson (spin is provided by build requirements)
RUN python3 -m pip install -r requirements/build_requirements.txt
# Build the project with the specified Meson options
RUN spin build -- -Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none
# Ensure the built Python package is on PYTHONPATH for runtime usage
ENV PYTHONPATH=/numpy/build-install/lib/python3.12/site-packages:$PYTHONPATH
# Default to an interactive shell
CMD ["/bin/bash"]