47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
FROM php:8.4-apache
|
|
|
|
# Enable required Apache modules
|
|
RUN a2enmod ssl rewrite headers
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
libzip-dev \
|
|
openssl \
|
|
libgmp-dev \
|
|
apache2-utils \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-install -j$(nproc) gmp zip
|
|
RUN docker-php-ext-enable gmp
|
|
|
|
# Configure Apache SSL
|
|
RUN mkdir -p /etc/apache2/ssl && \
|
|
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
|
-keyout /etc/apache2/ssl/server.key \
|
|
-out /etc/apache2/ssl/server.crt \
|
|
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"
|
|
|
|
# Copy Apache config after enabling modules
|
|
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
|
|
RUN a2ensite 000-default.conf
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Copy application files
|
|
COPY . /var/www/html/
|
|
|
|
# Copy and set permissions for the startup script
|
|
COPY docker/startup.sh /usr/local/bin/startup.sh
|
|
RUN chmod +x /usr/local/bin/startup.sh
|
|
|
|
# Set file permissions
|
|
RUN chown -R www-data:www-data /var/www/html
|
|
|
|
# Expose HTTP and HTTPS ports
|
|
EXPOSE 80 443
|
|
|
|
# Start Apache with the startup script
|
|
CMD ["/usr/local/bin/startup.sh"]
|