Commit 373e2239 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Improve and optimize Dockerfile based on stretch-slim. Issue #3

parent 6a85c701
Pipeline #3021 passed with stage
in 6 minutes and 52 seconds
FROM debian:stretch
# FROM debian:stretch
FROM debian:stretch-slim
# FROM bitnami/minideb:stretch
# Authors: Valentino Lauciani and Matteo Quintiliani
LABEL maintainer="Valentino Lauciani <valentino.lauciani@ingv.it>"
......@@ -12,20 +16,9 @@ ENV EW_INSTALL_VERSION="earthworm"
ENV EW_INSTALL_BITS=64
ENV EW_RUN_DIR="$EW_INSTALL_HOME/$EW_INSTALL_VERSION"
# install packages
RUN apt-get update \
&& apt-get dist-upgrade -y --no-install-recommends \
&& apt-get install -y \
vim \
subversion \
curl \
make \
gfortran \
cmake \
git \
libcurl4-openssl-dev \
dh-autoreconf \
autotools-dev
# Deploy token for ew2openapi repository
ENV DEPLOY_TOKEN="gitlab+deploy-token-1"
ENV DEPLOY_SECRET="9c5vS1x_YsFC4LLHE4sS"
# Set 'root' pwd
RUN echo root:toor | chpasswd
......@@ -44,36 +37,75 @@ RUN echo "" >> /root/.bashrc \
&& echo "export EW_RUN_DIR=\"$EW_INSTALL_HOME/$EW_INSTALL_VERSION\"" >> /root/.bashrc \
&& echo "" >> /root/.bashrc
# Checkout only Earthworm libraries source and its dependencies
WORKDIR /opt
RUN svn checkout --depth empty svn://svn.isti.com/earthworm/trunk $EW_INSTALL_HOME/$EW_INSTALL_VERSION
WORKDIR $EW_INSTALL_HOME/$EW_INSTALL_VERSION/
RUN svn update --set-depth infinity include
RUN svn update --set-depth infinity lib
RUN svn update --set-depth infinity bin
RUN svn update --set-depth infinity environment
RUN svn update --set-depth infinity params
RUN svn update --set-depth empty src
RUN svn update --set-depth infinity src/libsrc
RUN svn update --set-depth empty src/seismic_processing
RUN svn update --set-depth infinity src/seismic_processing/hyp2000
RUN cp $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/earthworm.d $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/earthworm_global.d $EW_INSTALL_HOME/$EW_INSTALL_VERSION/params/
# Compile Earthworm libraries
WORKDIR $EW_INSTALL_HOME/$EW_INSTALL_VERSION/src/libsrc
RUN bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && make -f makefile.unix'
# Compile Earthworm hyp2000
WORKDIR $EW_INSTALL_HOME/$EW_INSTALL_VERSION/src/seismic_processing/hyp2000
RUN bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && make -f makefile.unix'
# Pull and Compile ew2openapi
WORKDIR $EW_RUN_DIR
COPY ew2openapi_compile.bash $EW_RUN_DIR/
RUN bash -v -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && ./ew2openapi_compile.bash'
# Download and install glibc
# install necessary packages
# checkout necessary Earthworm repository directory
# checkout and compile ew2openapi
# remove unnecessary packages
RUN apt-get clean \
&& apt-get update \
&& apt-get install -y \
subversion \
make \
gfortran \
cmake \
git \
libcurl4-openssl-dev \
dh-autoreconf \
autotools-dev \
&& apt-get clean \
&& svn checkout --depth empty svn://svn.isti.com/earthworm/trunk $EW_INSTALL_HOME/$EW_INSTALL_VERSION \
&& cd $EW_INSTALL_HOME/$EW_INSTALL_VERSION/ \
&& svn update --set-depth infinity include \
&& svn update --set-depth infinity lib \
&& svn update --set-depth empty bin \
&& svn update --set-depth infinity environment \
&& svn update --set-depth infinity params \
&& svn update --set-depth empty src \
&& svn update --set-depth infinity src/libsrc \
&& svn update --set-depth empty src/seismic_processing \
&& svn update --set-depth infinity src/seismic_processing/hyp2000 \
&& cp $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/earthworm.d $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/earthworm_global.d $EW_INSTALL_HOME/$EW_INSTALL_VERSION/params/ \
&& cd $EW_INSTALL_HOME/$EW_INSTALL_VERSION/src/libsrc \
&& bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && make -f makefile.unix' \
&& cd $EW_INSTALL_HOME/$EW_INSTALL_VERSION/src/seismic_processing/hyp2000 \
&& bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && make -f makefile.unix' \
&& cd $EW_RUN_DIR \
&& git clone https://${DEPLOY_TOKEN}:${DEPLOY_SECRET}@gitlab.rm.ingv.it/earthworm/ew2openapi.git/ \
&& cd ew2openapi \
&& git submodule update --init \
&& cd json-c \
&& sh autogen.sh \
&& ./configure --prefix=`pwd`/build CFLAGS="-std=c99" \
&& make \
&& make install \
&& cd - \
&& mkdir -p rabbitmq-c/build \
&& cd rabbitmq-c/build \
&& cmake -DENABLE_SSL_SUPPORT=OFF .. \
&& cmake --build . \
&& cd - \
&& bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && make -f makefile.unix static' \
&& cp $EW_INSTALL_HOME/$EW_INSTALL_VERSION/bin/ew2openapi ./ \
&& bash -c '. $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash && mkdir -p $EW_LOG' \
&& cd $EW_INSTALL_HOME/$EW_INSTALL_VERSION/ \
&& rm -fr .svn src include lib ew2openapi \
&& apt-get remove -y \
subversion \
make \
gfortran \
cmake \
git \
libcurl4-openssl-dev \
dh-autoreconf \
autotools-dev \
&& apt-get clean
# Copy file(s)
WORKDIR /opt
COPY entrypoint.sh /opt
# Run Hyp2000
ENTRYPOINT ["bash", "/opt/entrypoint.sh"]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment