ARG PHP_VERSION
FROM ${PHP_VERSION}

ARG TZ
ARG PHP_EXTENSIONS
ARG CONTAINER_PACKAGE_URL

COPY ./docker-php-ext-enable /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-ext-enable

COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions
RUN chmod +x install.sh \
    && sh install.sh \
    && rm -fr /tmp/extensions

# php image's www-data user uid & gid are 82, change them to 1000 (primary user)
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
# Use www-data to run the first process
USER "www-data"

WORKDIR /www
