Skip to content
Snippets Groups Projects
Commit a004e135 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Refactor dockerbuild code

Former-commit-id: 93fb0552
parent 8df20d1a
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y \
aoflagger \
casacore-data \
casacore-dev \
libarmadillo8 \
libboost-date-time1.65.1 \
libboost-filesystem1.65.1 \
......@@ -95,6 +94,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libpng16-16 \
libxml2 \
python3.7 \
python3-casacore \
python3-numpy \
python3-scipy && \
rm -rf /var/lib/apt/lists/*
......@@ -121,19 +121,13 @@ ARG Dysco_TAG=master
LABEL Dysco.version.tag=${Dysco_TAG}
RUN apt update && apt install -y nodejs python3-pip git wsclean libcasa-python3-2 wcslib-dev libcfitsio-dev
RUN apt update && apt install -y nodejs python3-pip git wsclean
RUN python3 -m pip install cwltool cwl-runner -e "git://github.com/darafferty/LSMTool.git@${LSMTool_TAG}#egg=LSMTool" \
"toil[cwl]"==${TOIL_VERSION} \
matplotlib \
python-casacore
matplotlib
RUN python3 -m pip install -e "git+https://github.com/revoltek/losoto.git@${LoSoTo_TAG}#egg=LoSoTo"
ADD L570745_uv_first10.MS.tar.xz /data
ADD skymodels.tar.gz /data/skymodels
ADD test_data/A-Team_lowres.sourcedb /data/A-Team_lowres.sourcedb
ADD test_data/example.h5 /data/example.h5
ADD test_data/L570745_SB001_uv_MODEL.MS /data/L570745_SB001_uv_MODEL.MS
ADD losoto.patch /home/lofaruser/losoto.patch
RUN patch /src/losoto/losoto/operations/__init__.py /home/lofaruser/losoto.patch
ADD .entrypoint /home/lofaruser/.entrypoint
......@@ -143,8 +137,9 @@ RUN chown lofaruser:lofaruser /home/lofaruser/.entrypoint && \
WORKDIR /home/lofaruser
COPY prefactor/scripts/* /opt/lofar/scripts/
COPY prefactor/skymodels /data/skymodels
COPY prefactor/rfistrategies /data/rfistrategies
COPY prefactor/skymodels/* /data/skymodels/
COPY prefactor/rfistrategies/* /data/rfistrategies/
COPY prefactor/solutions/ /data/solutions/*
RUN ln -sf /opt/lofar/scripts/* /usr/local/bin/
......
FROM kernsuite/base:5 as builder
FROM lofareosc/prefactor
SHELL ["/bin/bash", "-c"]
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
casacore-data \
casacore-dev \
libboost-python-dev \
libcfitsio-dev \
python-dev \
python3-numpy \
cmake \
build-essential \
libhdf5-serial-dev \
libarmadillo-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-date-time-dev \
libboost-signals-dev \
libboost-program-options-dev \
libboost-test-dev \
libxml2-dev \
libpng-dev \
pkg-config \
aoflagger-dev \
libgtkmm-3.0-dev \
git \
wget \
libfftw3-dev \
libgsl-dev
RUN mkdir -p /src/
WORKDIR /src/
# Build the IDG version from source
ADD ./idg /src/idg/src
RUN mkdir idg/build && cd idg/build && cmake -DCMAKE_INSTALL_PREFIX=/usr/local/ ../src && make install -j2
ADD ./DP3 /src/dp3/src
RUN cd /src/dp3/ && \
mkdir build && \
cd build && \
cmake ../src -DCMAKE_INSTALL_PREFIX=/usr/local/ -DPORTABLE=True &&\
make -j2 && \
make install -j2
ADD ./STMAN /src/STMAN/src
RUN cd /src/STMAN/ && \
mkdir build && \
cd build && \
cmake ../src -DCMAKE_INSTALL_PREFIX=/usr/local/ -DPORTABLE=True && \
make -j2 && \
make install -j2
ADD ./Dysco /src/Dysco/src
RUN cd /src/Dysco/ && \
mkdir build && \
cd build && \
cmake ../src -DCMAKE_INSTALL_PREFIX=/usr/local/ -DPORTABLE=True && \
make -j2 && \
make install -j2
#----------------------------------------------
FROM kernsuite/base:4 as runner
COPY --from=builder /usr/local/ /usr/local
SHELL ["/bin/bash", "-c"]
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
aoflagger \
casacore-data \
casacore-dev \
libarmadillo8 \
libboost-date-time1.65.1 \
libboost-filesystem1.65.1 \
libboost-python1.65.1 \
libboost-program-options1.65.1 \
libboost-system1.65.1 \
libboost-signals1.65.1 \
libboost-test1.65.1 \
libboost-python1.65-dev \
libcfitsio5 \
libgtkmm-3.0 \
libfftw3-3 \
libhdf5-cpp-100 \
libpng16-16 \
libstationresponse0 \
libxml2 \
python3.7 \
python3-numpy \
python3-scipy && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /home/lofaruser/ && \
groupadd -r lofaruser && \
useradd --no-log-init -r -g lofaruser lofaruser && \
chown lofaruser:lofaruser /home/lofaruser
ARG TOIL_VERSION=3.20.0
LABEL toil.version=${TOIL_VERSION}
ARG LSMTool_TAG=master
LABEL LSMTool.version.tag=${LSMTool_TAG}
ARG LoSoTo_TAG=master
LABEL LoSoTo.version.tag=${LoSoTo_TAG}
ARG STMAN_TAG=master
LABEL STMAN.version.tag=${STMAN_TAG}
ARG Dysco_TAG=master
LABEL Dysco.version.tag=${Dysco_TAG}
RUN apt update && apt install -y nodejs python3-pip git wsclean libcasa-python3-2 wcslib-dev libcfitsio-dev
RUN python3 -m pip install cwltool cwl-runner -e "git://github.com/darafferty/LSMTool.git@${LSMTool_TAG}#egg=LSMTool" \
"toil[cwl]"==${TOIL_VERSION} \
matplotlib \
python-casacore
RUN python3 -m pip install -e "git+https://github.com/revoltek/losoto.git@${LoSoTo_TAG}#egg=LoSoTo"
ADD L570745_uv_first10.MS.tar.xz /data
ADD skymodels.tar.gz /data/skymodels
ADD test_data/A-Team_lowres.sourcedb /data/A-Team_lowres.sourcedb
ADD test_data/example.h5 /data/example.h5
ADD test_data/L570745_SB001_uv_MODEL.MS /data/L570745_SB001_uv_MODEL.MS
ADD losoto.patch /home/lofaruser/losoto.patch
RUN patch /src/losoto/losoto/operations/__init__.py /home/lofaruser/losoto.patch
ADD .entrypoint /home/lofaruser/.entrypoint
RUN chown lofaruser:lofaruser /home/lofaruser/.entrypoint && \
chmod +rx /home/lofaruser/.entrypoint
WORKDIR /home/lofaruser
COPY scripts/* /opt/lofar/scripts/
RUN ln -sf /opt/lofar/scripts/* /usr/local/bin/
RUN chmod +rx /usr/local/bin/*
ENV PYTHONPATH="/opt/lofar/scripts:${PYTHONPATH}"
ENTRYPOINT ["/home/lofaruser/.entrypoint"]
USER lofaruser
ARG DP3_TAG=master
ARG IDG_TAG=master
LABEL IDG.version.tag=${IDG_TAG}
LABEL DP3.version.tag=${DP3_TAG}
......@@ -9,7 +9,6 @@ git_clone_or_pull () {
then
git -C "${DIR}" pull
else
mkdir -p ${DIR}
git clone --depth 1 -b "${BRANCH}" "${REPO}" "${DIR}"
fi
}
......@@ -22,6 +21,7 @@ LoSoTo_TAG=f0398b
TOIL_VERSION=3.20.0
STMAN_TAG=master
Dysco_TAG=v1.2
Prefactor_TAG=master
# FETCHES THE IDG
git_clone_or_pull https://gitlab.com/astron-idg/idg/ ${IDG_TAG} idg
......@@ -35,12 +35,9 @@ git_clone_or_pull https://github.com/lofar-astron/LofarStMan ${STMAN_TAG} STMAN
# FETCHES Dysco
git_clone_or_pull https://github.com/aroffringa/dysco.git ${Dysco_TAG} Dysco
# FETCHES Prefactor
git_clone_or_pull https://github.com/lofar-astron/prefactor.git ${Prefactor_TAG} prefactor
# FETCHES THE SCRIPTS ONLY
BRANCH=production
REPO_URL=https://github.com/lofar-astron/prefactor
svn checkout ${REPO_URL}/branches/${BRANCH}/scripts
SCRIPT_PATH=$(realpath ${BASH_SOURCE[0]})
DOCKER_PATH=$(dirname ${SCRIPT_PATH})
......@@ -52,4 +49,6 @@ docker build ${DOCKER_PATH} --build-arg=IDG_TAG=${IDG_TAG}\
--build-arg=STMAN_TAG=${STMAN_TAG}\
--build-arg=Dysco_TAG=${Dysco_TAG}\
--build-arg=TOIL_VERSION=${TOIL_VERSION}\
-t lofareosc/prefactor-ci
-t lofareosc/prefactor
docker build ${DOCKER_PATH} -f ${DOCKER_PATH}/Dockerfile_ci -t lofareosc/prefactor-ci
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment