FROM debian:bullseye-slim # Expose HuggingFace port EXPOSE 7860 # Install Apache, PHP 7.4 and extensions RUN apt-get update && apt-get install -y \ apache2 \ php7.4 \ php7.4-cli \ php7.4-mysql \ php7.4-pgsql \ php7.4-gd \ php7.4-xml \ php7.4-mbstring \ php7.4-curl \ php7.4-zip \ php7.4-soap \ libapache2-mod-php7.4 \ wget \ curl \ git \ && a2enmod rewrite php7.4 \ && rm -rf /var/lib/apt/lists/* # Configure Apache for port 7860 RUN sed -i 's/Listen 80/Listen 7860/g' /etc/apache2/ports.conf \ && sed -i 's/:80/:7860/g' /etc/apache2/sites-available/000-default.conf # Set ServerName RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf # Copy ProcessMaker files WORKDIR /var/www/html COPY processmaker-files/ /var/www/html/ # Set DocumentRoot to workflow/public_html RUN sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/html/workflow/public_html|' /etc/apache2/sites-available/000-default.conf # Configure Apache to use app.php as index and enable mod_rewrite RUN sed -i 's||\n\tOptions Indexes FollowSymLinks\n\tAllowOverride All\n\tDirectoryIndex app.php index.html index.php\n\tRequire all granted\n\n\n|' /etc/apache2/apache2.conf # Create .htaccess for URL rewriting RUN echo '' > /var/www/html/workflow/public_html/.htaccess.rewrite && \ echo ' RewriteEngine On' >> /var/www/html/workflow/public_html/.htaccess.rewrite && \ echo ' RewriteCond %{REQUEST_FILENAME} !-f' >> /var/www/html/workflow/public_html/.htaccess.rewrite && \ echo ' RewriteCond %{REQUEST_FILENAME} !-d' >> /var/www/html/workflow/public_html/.htaccess.rewrite && \ echo ' RewriteRule ^(.*)$ app.php [QSA,L]' >> /var/www/html/workflow/public_html/.htaccess.rewrite && \ echo '' >> /var/www/html/workflow/public_html/.htaccess.rewrite && \ cat /var/www/html/workflow/public_html/.htaccess.rewrite >> /var/www/html/workflow/public_html/.htaccess # Set permissions (like Laravel TODO) RUN chmod -R 777 /var/www/html # Environment variables for database ENV DB_HOST=${DB_HOST:-localhost} ENV DB_PORT=${DB_PORT:-5432} ENV DB_NAME=${DB_NAME:-postgres} ENV DB_USER=${DB_USER:-postgres} ENV DB_PASS=${DB_PASS:-} # Copy entrypoint script COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh CMD ["/entrypoint.sh"]