FROM centos:7.6.1810
LABEL maintainer="Nobuo Okazaki(CROSS)"
ARG SRCPREFIX=/tmp/src
ARG BUILDDEPS=https://download.mlf.io/pub/utsusemi/build-deps/0.3.7
ARG OSVER=7.6.1810

# Base setup
RUN rm /etc/localtime \
 && ln -s ../usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
 && yum-config-manager --add-repo https://download.mlf.io/pub/centos/mlf.io-CentOS-$OSVER.repo \
 && yum-config-manager --add-repo https://download.mlf.io/pub/epel/mlf.io-epel.repo \
 && yum-config-manager --disable base,extras,updates \
 && yum -y groupinstall "Development Tools" \
 && yum -y install python python2-future bash tzdata openssh-clients \
 && yum clean all

# Packaging utility script
COPY src/mkpkg $SRCPREFIX/mkpkg

# Build and install mxml
COPY src/manyo-deps-mxml $SRCPREFIX/manyo-deps-mxml
RUN cd $SRCPREFIX/manyo-deps-mxml \
 && curl $BUILDDEPS/mxml-2.9-1.el7.src.rpm -o mxml-2.9-1.el7.src.rpm \
 && rpm2cpio mxml-2.9-1.el7.src.rpm | cpio -idmv \
 && cd $SRCPREFIX \
 && ./mkpkg manyo-deps-mxml \
 && cd dist \
 && yum -y install manyo-deps-mxml-*

# Build and install Nexus
COPY src/manyo-deps-nexus $SRCPREFIX/manyo-deps-nexus
#OBSOLETE: RUN wget https://github.com/nexusformat/code/releases/download/4.3.1/nexus-4.3.1.tar.gz -O $SRCPREFIX/manyo-deps-nexus/nexus-4.3.1.tar.gz \
RUN curl $BUILDDEPS/nexus-4.3.1.tar.gz -o $SRCPREFIX/manyo-deps-nexus/nexus-4.3.1.tar.gz \
 && cd $SRCPREFIX \
 && ./mkpkg manyo-deps-nexus \
 && cd dist \
 && yum -y install manyo-deps-nexus-*

# Build and install matplotlib-wx
# matplotlib for wx is not contained matplotlib package after CentOS 7
# OBSOLETE: yumdownloader --source python-matplotlib-1.2.0-15.el7 \
COPY src/manyo-deps-python-matplotlib $SRCPREFIX/manyo-deps-python-matplotlib
RUN cd $SRCPREFIX/manyo-deps-python-matplotlib \
 && curl $BUILDDEPS/python-matplotlib-1.2.0-15.el7.src.rpm -o python-matplotlib-1.2.0-15.el7.src.rpm \
 && rpm2cpio python-matplotlib-1.2.0-15.el7.src.rpm | cpio -idmv \
 && cd $SRCPREFIX \
 && ./mkpkg manyo-deps-python-matplotlib \
 && cd dist \
 && yum -y install manyo-deps-python-matplotlib-*

