Jeroen De Meerleer
0fc2298106
Health check commands have been added to the Dockerfiles. These checks will run at an interval of 30 seconds, with a timeout of 10 seconds and a start period of 5 seconds. The system will retry these checks up to three times before marking the service as unhealthy. Different health check commands are used depending on the specific Dockerfile.
60 lines
2.2 KiB
Docker
60 lines
2.2 KiB
Docker
FROM node:22 AS nodebuilder
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
RUN apt-get update -y && apt-get install -y git
|
|
|
|
RUN git clone https://git.jeroened.be/webcron/webcron.git /tmp/buildir/webcron
|
|
WORKDIR /tmp/buildir/webcron
|
|
RUN npm install
|
|
RUN npm run build
|
|
RUN rm -rf node_modules
|
|
|
|
FROM php:8.3-apache
|
|
ENV APACHE_DOCUMENT_ROOT=/var/www/webcron/public/
|
|
ENV WEBCRON_ROOT=/var/www/webcron/
|
|
ENV TZ=Europe/Brussels
|
|
ENV COMPOSER_ALLOW_SUPERUSER=1 DEBIAN_FRONTEND=noninteractive
|
|
|
|
COPY --from=nodebuilder --chown=www-data:www-data /tmp/buildir/webcron ${WEBCRON_ROOT}
|
|
|
|
ARG VERSION
|
|
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 curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin
|
|
RUN set -eux; \
|
|
chmod uga+x /usr/local/bin/install-php-extensions && sync
|
|
|
|
RUN set -eux;install-php-extensions intl
|
|
RUN set -eux;install-php-extensions pdo_mysql
|
|
RUN set -eux;install-php-extensions opcache
|
|
RUN set -eux;install-php-extensions pcntl
|
|
RUN set -eux;install-php-extensions zip
|
|
|
|
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
|
|
|
|
COPY wait-for-it.sh /usr/local/bin/wait-for-it.sh
|
|
COPY apache2-foreground /usr/local/bin/apache2-foreground
|
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
|
RUN set -eux; \
|
|
chmod uga+x /usr/local/bin/wait-for-it.sh && \
|
|
chmod uga+x /usr/local/bin/entrypoint.sh && \
|
|
chmod uga+x /usr/local/bin/apache2-foreground && sync
|
|
|
|
USER www-data
|
|
WORKDIR ${WEBCRON_ROOT}
|
|
RUN mv .env.sample .env
|
|
RUN composer install
|
|
|
|
RUN bash -c "if [ -n \"${VERSION}\" ] ; then echo ${VERSION} > ${WEBCRON_ROOT}/version ; fi"
|
|
|
|
USER root
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD curl -f http://localhost:80/health || exit 1
|