FROM php:8.2-fpm # Install system dependencies RUN apt-get update && apt-get install -y \ libonig-dev \ libpng-dev \ libxml2-dev \ zip \ unzip \ git \ curl # Install PHP extensions RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd # Download and install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Set working directory to /app WORKDIR /app # Check if we are in a local or online environment ARG APP_ENV RUN --mount=type=secret,id=GITHUB_PAT \ git clone --branch next https://lucianotonet:$(cat /run/secrets/GITHUB_PAT)@github.com/agenciamav/app.agenciamav.com.br.git . # If local, just copy the files COPY . /app # Install PHP dependencies RUN --mount=type=secret,id=OPENAI_API_KEY \ composer install # Run initial Laravel commands RUN php artisan storage:link && \ php artisan config:cache && \ php artisan route:cache && \ php artisan view:cache # Change the owner and permissions of the log directory RUN chown -R www-data:www-data /app/storage && \ chmod -R 775 /app/storage && \ chown -R www-data:www-data /app/bootstrap/cache && \ chmod -R 775 /app/bootstrap/cache && \ touch /app/storage/logs/laravel.log && \ chown www-data:www-data /app/storage/logs/laravel.log && \ chmod -R 775 /app/storage/logs/laravel.log EXPOSE 7860 # Run the script when the container starts CMD ["sh", "-c", "php artisan serve --host=0.0.0.0 --port=7860"]