IMAGE seeddms_6.0.14-210106
FROM alpine3.12-php7.3_7.3.25-210106

RUN EOF
    # Install runtime dependencies
    apk --no-cache add ghostscript imagemagick libreoffice-calc libreoffice-impress libreoffice-writer php7-curl php7-fileinfo php7-iconv php7-intl php7-openssl php7-pear php7-pdo_pgsql php7-simplexml php7-xml php7-xsl php7-zip poppler-utils python3 ttf-opensans
    ln -s /usr/bin/python3 /usr/bin/python

    # Install unoconv
    wget https://raw.githubusercontent.com/dagwieers/unoconv/master/unoconv -O /usr/bin/unoconv
    chmod +x /usr/bin/unoconv

    # Install full-featured wget to work around sourceforge bugs
    apk --no-cache add wget

    # Install SeedDMS
    wget https://sourceforge.net/projects/seeddms/files/seeddms-6.0.14/seeddms-quickstart-6.0.14.tar.gz/download -O - | tar xzf - -C /srv
    mv /srv/seeddms* /srv/seeddms
EOF

COPY image.d

RUN EOF
    # Create OS user
    addgroup -S -g 8080 seeddms
    adduser -S -u 8080 -h /srv/seeddms -s /bin/false -g seeddms -G seeddms seeddms
    chown -R seeddms:seeddms /srv/seeddms

    # Cleanup
    apk --no-cache del wget
    rm -f /srv/seeddms/www/install
    rm -rf /srv/seeddms/data/conf /srv/seeddms/www/ext/example
EOF

CMD /bin/s6-svscan /etc/services.d