FROM centos:8

# ===================================================
# =================== Base stuff ====================
# Base stuff section copied from Carlos Rueda's 
# Dockerfiles for LRAUV applications, see:
#   https://bitbucket.org/mbari/lrauv-application/src/master/docker/Dockerfile

RUN yum -y groupinstall "Development Tools"
RUN yum -y install \
        autoconf \
        automake \
        glib* \
        make \
        openssl-devel \
        libtool \
        readline-devel \
        wget \
        zlib-devel \
        cmake      \
        python3 \
        libpcap \
 && \
    mkdir /root/build

RUN yum -y install dnf-plugins-core \
 && dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
 && yum -y update && yum -y upgrade \
 && yum config-manager --set-enabled powertools \
 && yum -y install libpcap-devel \
    hdf5 \
    hdf5-devel \
    hdf5-static 
    
# lcm
RUN cd /root/build/ \
 && wget https://github.com/lcm-proj/lcm/archive/refs/tags/v1.4.0.tar.gz \
 && tar xf v1.4.0.tar.gz \
 && cd lcm-1.4.0 \
 && mkdir -p build && cd build \
 && cmake .. \
 && make && make install \
 && ldconfig /usr/local/lib


# ===================================================
# =================== Tools Building ================

COPY . /opt/wec/
RUN cd /opt/wec/       \
 && rm -rf build       \
 && mkdir -p build     \
 && cd build           \
 && cmake ../          \
 && make               \
 && make install       

