opnform-host-nginx/docker/Dockerfile.api

83 lines
2.0 KiB
Docker
Raw Normal View History

Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Build stage - using PHP CLI image with extensions
FROM php:8.3-cli AS builder
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Install composer and extensions needed for dependency installation
RUN apt-get update && apt-get install -y \
libzip-dev \
libpng-dev \
unzip \
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
git \
&& docker-php-ext-install -j$(nproc) \
bcmath \
gd \
zip \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
WORKDIR /app
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Copy the entire source code for proper installation
COPY api/ .
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Install dependencies including dev dependencies
RUN composer install --optimize-autoloader --no-interaction \
--ignore-platform-req=php \
--ignore-platform-req=ext-bcmath \
--ignore-platform-req=ext-gd
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Final stage - smaller runtime image
FROM php:8.3-fpm-alpine
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Install runtime dependencies
RUN apk add --no-cache \
libzip \
libpng \
postgresql-client \
libpq \
procps \
unzip \
bash \
icu-libs \
&& rm -rf /var/cache/apk/*
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Install build dependencies and PHP extensions
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
libzip-dev \
libpng-dev \
postgresql-dev \
oniguruma-dev \
icu-dev \
&& docker-php-ext-configure pgsql \
&& docker-php-ext-configure gd \
&& docker-php-ext-install -j$(nproc) \
pdo \
zip \
gd \
pgsql \
pdo_pgsql \
bcmath \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apk del .build-deps
WORKDIR /usr/share/nginx/html/
# Create storage directories
RUN mkdir -p storage/framework/sessions \
storage/framework/views \
storage/framework/cache \
storage/logs \
storage/app/public \
bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache
Enhance Docker Configuration and Health Checks (#761) * Enhance Docker Configuration and Health Checks - Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications. - Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability. - Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features. - Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment. - Removed outdated PHP configuration files to streamline the Docker setup. These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment. * Refactor Dockerfile for Improved Build Process - Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency. - Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size. - Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability. - Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment. These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
# Copy the entire application from the builder stage
COPY --from=builder /app/ ./
# Setup entrypoint
COPY docker/php-fpm-entrypoint /usr/local/bin/opnform-entrypoint
RUN chmod a+x /usr/local/bin/*
ENTRYPOINT ["/usr/local/bin/opnform-entrypoint"]
CMD ["php-fpm"]