IMAGE crismapp_0.0.1-200411
FROM alpine3.8-php5.6_5.6.40-200403

RUN EOF
    # Install runtime dependencies
    apk --no-cache add php5-mysqli php5-pdo_mysql

    # Install build dependencies
    apk --no-cache add --virtual .deps git

    # Clone Crismapp
    git clone https://github.com/rostanetek/crismapp /srv/crismapp
EOF

COPY image.d

RUN EOF
    # Patch config
    cd /srv/crismapp
    patch -p0 </config.patch
    rm /config.patch

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

    # Cleanup
    apk --no-cache del .deps
    find /srv/crismapp -name '.git*' -exec rm -rf {} +
EOF

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