FROM salvatti_base as salvatti_dev
ENV APP_DIRECTORY /var/www/salvatti/
WORKDIR $APP_DIRECTORY

RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

COPY ./docker/dev/vhost.conf /etc/apache2/sites-available/salvatti.conf
RUN a2ensite salvatti

COPY ./docker/dev/custom-php.ini $PHP_INI_DIR/conf.d/
COPY /docker/dev/cron.txt /etc/cron.d/crontab

RUN dos2unix /etc/cron.d/crontab
RUN chmod 0744 /etc/cron.d/crontab
RUN crontab /etc/cron.d/crontab
RUN touch /var/log/cron.log

CMD ["apache2-foreground"]

COPY ./docker/dev/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]