FROM 192.168.2.196/base/graphicsmagick_jkd1.8
MAINTAINER wangxiaoke
MAINTAINER wangke@zhaotai.ren
WORKDIR /opt/application/
USER root
ADD Apache_OpenOffice_4.1.5_Linux_x86-64_install-rpm_zh-CN.tar.gz /opt/application/
ADD winfonts.tar.gz /usr/share/fonts/
ADD pdf2htmlEX-0.14.6.tar.gz /opt/application/
ADD fontforge-pdf2htmlEX.tar.gz /opt/application/
ADD html2text.py /opt/application/
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
    LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
    JAVA_HOME=/opt/jdk1.8.0_131 \
    JAVA_BIN=/opt/jdk1.8.0_131/bin \
    CLASSPATH=/opt/jdk1.8.0_131/lib:/opt/jdk1.8.0_131/jrelib:${CLASSPATH} \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/jdk1.8.0_131/bin:/opt/jdk1.8.0_131/jre/bin:/opt/maven-3.1.1/bin:/opt/node-v8.11.1-linux-x64/bin:/root/bin:$PATH
RUN yum install -y xorg-x11-font-utils fontconfig cmake gcc gnu-getopt libpng-devel fontforge-devel \
                   cairo-devel poppler-devel libspiro-devel freetype-devel poppler-data libjpeg-turbo-devel \
                   git make gcc-c++ pango-devel libjpeg-turbo.x86_64 libjpeg-turbo-devel libjpeg-turbo-devel.x86_64 \
                   libtiff.x86_64 libtiff-devel openjpeg-devel.x86_64 openjpeg giflibgiflib-devel libxml2.x86_64 \
                   libxml2-devel libspiro.x86_64 libspiro-devel libuninameslist-devel.x86_64i xorg-x11-util-macros.noarch \
                   libtool patch libtool-ltdl-devel libXext.x86_64 && rm -rf /var/cache/yum/*
RUN cd zh-CN/RPMS/ && \
        rpm -ivh *.rpm && \
        rpm -ivh desktop-integration/openoffice4.1.5-redhat-menus-4.1.5-9789.noarch.rpm && \
        mkfontscale && mkfontdir && fc-cache && cd /opt/application/ && \
        cd fontforge-pdf2htmlEX && ./autogen.sh && ./configure && make && make install && cd /opt/application/ && mv pdf2htmlEX-0.14.6 pdf2htmlEX && \
        chmod 775 html2text.py && \
        cd pdf2htmlEX && cmake . && make && make install && rm -rf /usr/local/src/* && rpm -qa | grep openjdk | xargs rpm -e --nodeps