docker/dockerfile

39 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-04-29 14:49:31 +02:00
FROM php:8.1-apache AS phpbuilder
2021-05-26 20:52:04 +02:00
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /tmp/buildir/
2022-04-29 14:49:31 +02:00
RUN apt-get update -y && apt-get install -y git libzip-dev libicu-dev
RUN docker-php-ext-install zip intl pcntl pdo
2021-05-26 20:52:04 +02:00
RUN git clone https://git.jeroened.be/webcron/webcron.git
WORKDIR /tmp/buildir/webcron
2022-04-29 14:49:31 +02:00
COPY .env /tmp/buildir/webcron/.env
2021-05-26 20:52:04 +02:00
RUN composer install
2022-04-29 14:49:31 +02:00
FROM node:16 as nodebuilder
2021-05-26 20:52:04 +02:00
COPY --from=phpbuilder /tmp/buildir/webcron /tmp/buildir/webcron
WORKDIR /tmp/buildir/webcron
RUN npm install
2022-05-02 13:35:37 +02:00
RUN npm run build
2021-05-26 20:52:04 +02:00
RUN rm -rf node_modules
2022-04-29 14:49:31 +02:00
FROM php:8.1-apache
2021-05-26 20:52:04 +02:00
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
2022-04-29 14:49:31 +02:00
RUN apt-get update -y && apt-get install -y libicu-dev
RUN docker-php-ext-install intl pcntl pdo pdo_mysql
2021-05-26 20:52:04 +02:00
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
2022-04-29 14:49:31 +02:00
ENTRYPOINT service apache2 restart && php ${WEBCRON_ROOT}bin/console daemon