2021-05-26 20:52:04 +02:00
|
|
|
FROM php:8.0-apache AS phpbuilder
|
|
|
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
WORKDIR /tmp/buildir/
|
|
|
|
RUN apt-get update -y && apt-get install -y git libzip-dev
|
|
|
|
RUN docker-php-ext-install zip
|
|
|
|
RUN git clone https://git.jeroened.be/webcron/webcron.git
|
|
|
|
WORKDIR /tmp/buildir/webcron
|
|
|
|
RUN composer install
|
|
|
|
|
|
|
|
FROM node:14 as nodebuilder
|
|
|
|
COPY --from=phpbuilder /tmp/buildir/webcron /tmp/buildir/webcron
|
|
|
|
WORKDIR /tmp/buildir/webcron
|
|
|
|
RUN npm install
|
|
|
|
RUN npx encore prod
|
|
|
|
RUN rm -rf node_modules
|
|
|
|
|
|
|
|
FROM php:8.0-apache
|
|
|
|
ENV APACHE_DOCUMENT_ROOT=/var/www/webcron/public/
|
|
|
|
ENV WEBCRON_ROOT=/var/www/webcron/
|
|
|
|
ENV TZ=Europe/Brussels
|
|
|
|
|
|
|
|
USER www-data
|
2021-08-02 14:15:47 +02:00
|
|
|
COPY --from=nodebuilder --chown=www-data:www-data /tmp/buildir/webcron ${WEBCRON_ROOT}
|
2021-05-26 20:52:04 +02:00
|
|
|
WORKDIR ${WEBCRON_ROOT}
|
|
|
|
|
|
|
|
USER root
|
|
|
|
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf
|
|
|
|
RUN sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
|
|
|
RUN a2enmod rewrite
|
|
|
|
|
|
|
|
RUN docker-php-ext-install pcntl
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
|
|
|
RUN printf "[PHP]\ndate.timezone = \"$TZ\"\n" > /usr/local/etc/php/conf.d/tzone.ini
|
2021-08-02 14:15:47 +02:00
|
|
|
|
2021-05-26 20:52:04 +02:00
|
|
|
ENTRYPOINT service apache2 restart && php ${WEBCRON_ROOT}webcron daemon
|