Skip to content

Commit

Permalink
re-docker from hyperdrive
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Sep 27, 2024
1 parent f3aa9ec commit 39fa2fd
Showing 1 changed file with 21 additions and 110 deletions.
131 changes: 21 additions & 110 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# ref: https://docs.docker.com/build/building/multi-platform/
# ARG BASE_IMG="ubuntu:20.04"
# HACK: newer python breaks on old ubuntu
ARG BASE_IMG="python:3.11-bookworm"
FROM ${BASE_IMG} AS base
FROM mwatelescope/hyperdrive:latest-python3.11-slim-bookworm AS base

# Suppress perl locale errors
ENV LC_ALL=C
Expand All @@ -18,10 +17,7 @@ RUN apt-get update && \
clang \
cmake \
curl \
cython3 \
fontconfig \
g++ \
ipython3 \
jq \
lcov \
libatlas3-base \
Expand All @@ -31,29 +27,20 @@ RUN apt-get update && \
libboost-program-options-dev \
libboost-system-dev \
libboost-test-dev \
libcfitsio-dev \
liberfa-dev \
libexpat1-dev \
libfftw3-dev \
libfontconfig-dev \
libfreetype-dev \
libgsl-dev \
libgtkmm-3.0-dev \
libhdf5-dev \
liblapack-dev \
liblua5.3-dev \
libopenmpi-dev \
libpng-dev \
libpython3-dev \
libssl-dev \
libxml2-dev \
pkg-config \
procps \
python3 \
python3-dev \
python3-pip \
python3-wheel \
python3-importlib-metadata \
tzdata \
unzip \
wget \
Expand All @@ -63,55 +50,13 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
apt-get -y autoremove

# Get Rust
ARG RUST_VERSION=1.80
ENV RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/cargo PATH="/opt/cargo/bin:${PATH}"
RUN mkdir -m755 $RUSTUP_HOME $CARGO_HOME && ( \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | env RUSTUP_HOME=$RUSTUP_HOME CARGO_HOME=$CARGO_HOME sh -s -- -y \
--profile=minimal \
--default-toolchain=${RUST_VERSION} \
)

# install python prerequisites
# - newer pip needed for mwalib maturin install
# - other versions pinned to avoid issues with numpy==2
ARG SSINS_BRANCH=master
ARG MWAQA_BRANCH=dev
RUN python -m pip install --no-cache-dir \
importlib_metadata==8.2.0 \
kneed==0.8.5 \
matplotlib==3.7.5 \
maturin[patchelf]==1.7.0 \
numpy==1.24.4 \
pandas==2.0.3 \
pip==24.2 \
pyuvdata==2.4.5 \
pyvo==1.5.2 \
seaborn==0.13.2 \
tabulate==0.9.0 \
psutil==6.0.0 \
;

# python packages
RUN python -m pip install --no-cache-dir \
git+https://github.com/mwilensky768/SSINS.git@${SSINS_BRANCH} \
git+https://github.com/d3v-null/mwa_qa.git@${MWAQA_BRANCH} \
git+https://github.com/PaulHancock/Aegean.git \
git+https://github.com/tjgalvin/fits_warp.git \
;

ARG MWALIB_BRANCH=v1.5.0
RUN git clone --depth 1 --branch=${MWALIB_BRANCH} https://github.com/MWATelescope/mwalib.git /mwalib && \
cd /mwalib && \
maturin build --release --features=python && \
python -m pip install $(ls -1 target/wheels/*.whl | tail -n 1) && \
cd / && \
rm -rf /mwalib ${CARGO_HOME}/registry
RUN cargo install mwa_giant_squid --locked && \
rm -rf ${CARGO_HOME}/registry /opt/cargo/git/checkouts/

# for example, CMAKE_ARGS="-D CMAKE_CXX_FLAGS='-march=native -mtune=native -O3 -fomit-frame-pointer'"
ARG CMAKE_ARGS="-D PORTABLE=ON"
ARG CMAKE_ARGS="-DPORTABLE=True"

ARG EVERYBEAM_BRANCH=v0.5.2
ARG EVERYBEAM_BRANCH=v0.6.1
RUN git clone --depth 1 --branch=${EVERYBEAM_BRANCH} --recurse-submodules https://git.astron.nl/RD/EveryBeam.git /EveryBeam && \
cd /EveryBeam && \
git submodule update --init --recursive && \
Expand All @@ -133,7 +78,9 @@ RUN git clone --depth 1 --branch=${IDG_BRANCH} https://git.astron.nl/RD/idg.git
cd / && \
rm -rf /idg

ARG WSCLEAN_BRANCH=v3.4
# can't get wsclean2.X to compile on arm64 :(
# ARG WSCLEAN_BRANCH=wsclean2.9
ARG WSCLEAN_BRANCH=v3.5
RUN git clone --depth 1 --branch=${WSCLEAN_BRANCH} https://gitlab.com/aroffringa/wsclean.git /wsclean && \
cd /wsclean && \
git submodule update --init --recursive && \
Expand All @@ -144,55 +91,16 @@ RUN git clone --depth 1 --branch=${WSCLEAN_BRANCH} https://gitlab.com/aroffringa
cd / && \
rm -rf /wsclean

ARG GIANTSQUID_BRANCH=v1.0.3
RUN git clone --depth 1 --branch=${GIANTSQUID_BRANCH} https://github.com/MWATelescope/giant-squid.git /giant-squid && \
cd /giant-squid && \
cargo install --path . --locked && \
cd / && \
rm -rf /giant-squid ${CARGO_HOME}/registry

ARG AOFLAGGER_BRANCH=v3.4.0
RUN git clone --depth 1 --branch=${AOFLAGGER_BRANCH} --recurse-submodules https://gitlab.com/aroffringa/aoflagger.git /aoflagger && \
cd /aoflagger && \
mkdir build && \
cd build && \
cmake $CMAKE_ARGS \
-DENABLE_GUI=OFF \
.. && \
make install -j`nproc` && \
ldconfig && \
cd / && \
rm -rf /aoflagger
# set up aoflagger python library
ENV PYTHONPATH="/usr/local/lib/:$PYTHONPATH"

ARG BIRLI_GIT=https://github.com/MWATelescope/Birli.git
ARG BIRLI_BRANCH=main
RUN cargo install birli --locked --git=${BIRLI_GIT} --branch=${BIRLI_BRANCH} && \
rm -rf ${CARGO_HOME}/registry /opt/cargo/git/checkouts/

# WARNING: issues running maturin on arm64 since 2024-09-12, some horrible Python rabbit hole
# ARG HYPERBEAM_GIT=https://github.com/MWATelescope/mwa_hyperbeam.git
# ARG HYPERBEAM_BRANCH=main
# # ARG HYPERBEAM_BRANCH=marlu0.14
# ARG HYPERBEAM_FEATURES=python
# # This won't install the python library:
# # RUN cargo install mwa_hyperbeam --locked --git=${HYPERBEAM_GIT} --branch=${HYPERBEAM_BRANCH} --features=${HYPERBEAM_FEATURES} && \
# # rm -rf ${CARGO_HOME}/registry /opt/cargo/git/checkouts/
# RUN git clone --depth 1 --branch=${HYPERBEAM_BRANCH} ${HYPERBEAM_GIT} /hyperbeam && \
# cd /hyperbeam && \
# maturin build --locked --release --features=${HYPERBEAM_FEATURES} && \
# python -m pip install $(ls -1 target/wheels/*.whl | tail -n 1) && \
# cd / && \
# rm -rf /hyperbeam ${CARGO_HOME}/registry

ARG HYPERDRIVE_GIT=https://github.com/MWATelescope/mwa_hyperdrive.git
# ARG HYPERDRIVE_BRANCH=main
# # HACK: birli0.14 needs newer ndarray
ARG HYPERDRIVE_BRANCH=birli0.14
# TODO: ARG HYPERDRIVE_FEATURES= ... --features=${HYPERDRIVE_FEATURES}
RUN cargo install mwa_hyperdrive --verbose --debug --locked --git=${HYPERDRIVE_GIT} --branch=${HYPERDRIVE_BRANCH} && \
rm -rf ${CARGO_HOME}/registry /opt/cargo/git/checkouts/
# install python prerequisites
ARG SSINS_BRANCH=master
ARG MWAQA_BRANCH=dev
RUN python -m pip install --no-cache-dir \
pyvo==1.5.2 \
git+https://github.com/mwilensky768/SSINS.git@${SSINS_BRANCH} \
git+https://github.com/d3v-null/mwa_qa.git@${MWAQA_BRANCH} \
git+https://github.com/PaulHancock/Aegean.git \
git+https://github.com/tjgalvin/fits_warp.git \
;

# # download latest Leap_Second.dat, IERS finals2000A.all
RUN python -c "from astropy.time import Time; t=Time.now(); from astropy.utils.data import download_file; download_file('http://data.astropy.org/coordinates/sites.json', cache=True); print(t.gps, t.ut1)"
Expand Down Expand Up @@ -230,4 +138,7 @@ RUN cd /mwax_mover && \
# # docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} --entrypoint python mwatelescope/mwa-demo:latest /mwax_mover/scripts/cal_analysis.py --name foo --metafits ${metafits} --solns ${soln} --phase-diff-path=/mwax_mover/phase_diff.txt --plot-residual --residual-vmax=0.5
# # docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} --entrypoint python d3vnull0/mwax_mover:latest /app/scripts/cal_analysis.py --name foo --metafits ${metafits} --solns ${soln} --phase-diff-path=/app/phase_diff.txt --plot-residual --residual-vmax=0.5

ARG TEST_SHIM=""
RUN ${TEST_SHIM}

ENTRYPOINT /bin/bash

0 comments on commit 39fa2fd

Please sign in to comment.