opnform-host-nginx/docker/Dockerfile.api

60 lines
1.7 KiB
Docker
Raw Normal View History

Developer docker setup (#683) * Add build context to compose Signed-off-by: Daniel Ekman <knegge@gmail.com> * Update Docker documentation with build instructions Enhance Docker deployment documentation by: - Adding detailed instructions for building Docker images - Providing two methods for image building (Docker Compose and manual) - Clarifying how to use local images with docker-compose.override.yml * Add development Docker configuration Introduce development-specific Docker configuration: - Create docker-compose.dev.yml for local development setup - Add nginx.dev.conf with development CORS settings - Update Dockerfile.api to support environment-specific dependency installation - Configure development services with appropriate volumes and environment variables * Improve Docker and Development Documentation - Remove platform-specific ARM64 constraints in docker-compose.dev.yml - Enhance Nginx configuration with improved proxy and HMR settings - Update documentation for development setup and Docker deployment - Add new Docker development documentation page - Refactor getting started guide with clearer development instructions * Enhance Docker configuration and CI/CD pipeline - Update Docker Compose files with improved service configurations - Add database healthcheck in docker-compose.yml - Refactor GitHub Actions workflow for Docker image publishing - Optimize Dockerfile.api with multi-stage build and environment-specific configurations - Update Nginx configuration for development and production environments * Add GitHub Actions permissions for Docker image publishing Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process --------- Signed-off-by: Daniel Ekman <knegge@gmail.com> Co-authored-by: Daniel Ekman <knegge@gmail.com>
2025-01-28 17:52:48 +01:00
FROM php:8.3-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
libzip-dev \
libpng-dev \
postgresql-client \
libpq-dev \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
# Install PHP extensions
RUN docker-php-ext-install pdo pgsql pdo_pgsql gd bcmath zip \
&& pecl install redis \
&& docker-php-ext-enable redis
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
# Copy composer files and helpers.php first
COPY api/composer.json api/composer.lock ./
COPY api/app/helpers.php ./app/helpers.php
# Install dependencies without running scripts
RUN if [ "$APP_ENV" = "production" ] ; then \
composer install --no-dev --no-scripts --ignore-platform-req=php --optimize-autoloader ; \
else \
composer install --no-scripts --ignore-platform-req=php --optimize-autoloader ; \
Developer docker setup (#683) * Add build context to compose Signed-off-by: Daniel Ekman <knegge@gmail.com> * Update Docker documentation with build instructions Enhance Docker deployment documentation by: - Adding detailed instructions for building Docker images - Providing two methods for image building (Docker Compose and manual) - Clarifying how to use local images with docker-compose.override.yml * Add development Docker configuration Introduce development-specific Docker configuration: - Create docker-compose.dev.yml for local development setup - Add nginx.dev.conf with development CORS settings - Update Dockerfile.api to support environment-specific dependency installation - Configure development services with appropriate volumes and environment variables * Improve Docker and Development Documentation - Remove platform-specific ARM64 constraints in docker-compose.dev.yml - Enhance Nginx configuration with improved proxy and HMR settings - Update documentation for development setup and Docker deployment - Add new Docker development documentation page - Refactor getting started guide with clearer development instructions * Enhance Docker configuration and CI/CD pipeline - Update Docker Compose files with improved service configurations - Add database healthcheck in docker-compose.yml - Refactor GitHub Actions workflow for Docker image publishing - Optimize Dockerfile.api with multi-stage build and environment-specific configurations - Update Nginx configuration for development and production environments * Add GitHub Actions permissions for Docker image publishing Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process --------- Signed-off-by: Daniel Ekman <knegge@gmail.com> Co-authored-by: Daniel Ekman <knegge@gmail.com>
2025-01-28 17:52:48 +01:00
fi
# Copy the rest of the application
COPY api/ .
Developer docker setup (#683) * Add build context to compose Signed-off-by: Daniel Ekman <knegge@gmail.com> * Update Docker documentation with build instructions Enhance Docker deployment documentation by: - Adding detailed instructions for building Docker images - Providing two methods for image building (Docker Compose and manual) - Clarifying how to use local images with docker-compose.override.yml * Add development Docker configuration Introduce development-specific Docker configuration: - Create docker-compose.dev.yml for local development setup - Add nginx.dev.conf with development CORS settings - Update Dockerfile.api to support environment-specific dependency installation - Configure development services with appropriate volumes and environment variables * Improve Docker and Development Documentation - Remove platform-specific ARM64 constraints in docker-compose.dev.yml - Enhance Nginx configuration with improved proxy and HMR settings - Update documentation for development setup and Docker deployment - Add new Docker development documentation page - Refactor getting started guide with clearer development instructions * Enhance Docker configuration and CI/CD pipeline - Update Docker Compose files with improved service configurations - Add database healthcheck in docker-compose.yml - Refactor GitHub Actions workflow for Docker image publishing - Optimize Dockerfile.api with multi-stage build and environment-specific configurations - Update Nginx configuration for development and production environments * Add GitHub Actions permissions for Docker image publishing Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process --------- Signed-off-by: Daniel Ekman <knegge@gmail.com> Co-authored-by: Daniel Ekman <knegge@gmail.com>
2025-01-28 17:52:48 +01:00
# Run composer scripts and clear cache
RUN composer dump-autoload -o \
&& php artisan package:discover --ansi \
&& composer clear-cache \
&& chmod -R 775 storage \
&& chown -R www-data:www-data storage
# 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"]