39 lines
1.5 KiB
Plaintext
39 lines
1.5 KiB
Plaintext
FROM php:8.1-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 libicu-dev
|
|
RUN docker-php-ext-install zip intl pcntl pdo
|
|
RUN git clone https://git.jeroened.be/webcron/webcron.git
|
|
WORKDIR /tmp/buildir/webcron
|
|
COPY .env /tmp/buildir/webcron/.env
|
|
RUN composer install
|
|
|
|
FROM node:16 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.1-apache
|
|
ENV APACHE_DOCUMENT_ROOT=/var/www/webcron/public/
|
|
ENV WEBCRON_ROOT=/var/www/webcron/
|
|
ENV TZ=Europe/Brussels
|
|
|
|
USER www-data
|
|
COPY --from=nodebuilder --chown=www-data:www-data /tmp/buildir/webcron ${WEBCRON_ROOT}
|
|
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 apt-get update -y && apt-get install -y libicu-dev
|
|
RUN docker-php-ext-install intl pcntl pdo pdo_mysql
|
|
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
|
|
|
|
ENTRYPOINT service apache2 restart && php ${WEBCRON_ROOT}bin/console daemon
|