FROM registry.elipce.com/elipce/php:php7

ENV APP_DEBUG=$APP_DEBUG \
    COMPOSER_MEMORY_LIMIT=-1 \
    OPCACHE_ENABLE_CLI=0 \
    PATH=/app/bin:$PATH

RUN apk --update --no-cache add \
    libmcrypt php7-pecl-mcrypt \
	php7-json php7-pdo php7-pdo_mysql php7-soap php7-mbstring php7-zip \
	php7-intl php7-gd php7-curl \
    php7-session php7-ctype php7-fileinfo

# For PHP CodeSniffer
RUN apk --update --no-cache add \
    php7-tokenizer php7-xml php7-xmlwriter php7-simplexml

ADD --chown=user:user . /app

USER user

# install deps
RUN [ $APP_DEBUG -eq 1 ] || { composer install --no-dev && rm -rf ~/.composer/cache ; }

ARG APP_VERSION=0.0.0
ENV APP_VERSION=$APP_VERSION

COPY migrations.sh /entrypoint.d/migrations.sh
