FROM ubuntu:20.04

WORKDIR /website-src

# following is to avoid tzdata configuration wait for user input (https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai)
ARG DEBIAN_FRONTEND=noninteractive


RUN apt-get update -y && apt-get install -y nginx php-fpm php-mysql php-xml curl git subversion zlib1g-dev libzip-dev unzip zip 

RUN curl -sS https://getcomposer.org/installer -o /composer-setup.php \
    && php /composer-setup.php --install-dir=/usr/local/bin --filename=composer

ARG ACF_PRO_KEY=${ACF_PRO_KEY}
ENV ACF_PRO_KEY ${ACF_PRO_KEY}

COPY composer.json composer.lock ./
RUN  composer update 

COPY deploy/nginx.conf /etc/nginx/nginx.conf

COPY --chown=www-data:www-data . .
RUN chmod +x ./deploy/run.sh

RUN ./deploy/run.sh

COPY ./deploy/start.sh /
CMD /start.sh