custom-prometheus-exporter/dockerfile

46 lines
1.3 KiB
Plaintext
Raw Normal View History

# Gebruik een officiële PHP-image met Apache
FROM php:8.3-apache
# Stel de werkdirectory in
WORKDIR /var/www/html
# Kopieer de huidige directory inhoud naar /var/www/html in de container
COPY . /var/www/html
# Installeer Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Activeer mod_rewrite
RUN a2enmod rewrite
# Installeer git
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y git
# Installeer de Process Control extension
RUN curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s pcntl zip
# Voer composer install uit om de afhankelijkheden te installeren
RUN composer install
# Stel de poort in die de container zal exposeren
EXPOSE 9050
# Wijzig de Apache configuratie om op poort 9050 te luisteren
RUN sed -i 's/Listen 80/Listen 9050/' /etc/apache2/ports.conf
RUN sed -i 's/<VirtualHost *:80>/<VirtualHost *:9050>/' /etc/apache2/sites-available/000-default.conf
# Voeg environment variables toe aan de Apache configuratie
ENV PHP_BINARY=/usr/local/bin/php
ENV CONFIG_FILE=/var/www/html/config.php
# Activeer mod_rewrite
RUN a2enmod rewrite
# Start de Apache server
RUN mkdir -p /var/www/html/twig_cache
RUN chown -R www-data:www-data /var/www/html
USER www-data
# Start de Apache server
CMD ["apache2-foreground"]