-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDOCKERFILE
42 lines (31 loc) · 1.13 KB
/
DOCKERFILE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM php:8.2-apache-bullseye as php
# Install dependencies
RUN apt-get update && \
apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev
# Enable Apache modules
RUN a2enmod rewrite
RUN a2enmod headers
# Set PHP configurations
RUN echo "display_errors = Off" >> /usr/local/etc/php/php.ini
# Change Apache error log location
RUN sed -i 's/ErrorLog .*/ErrorLog \/var\/log\/apache2\/error.log/' /etc/apache2/sites-available/000-default.conf
# Change the Apache port
RUN sed -i 's/Listen 80/Listen 8080/' /etc/apache2/ports.conf
RUN sed -i 's/<VirtualHost *:80>/<VirtualHost *:8080>/' /etc/apache2/sites-available/000-default.conf
# Set a default ServerName to suppress warnings
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Set permissions for web root
RUN chown -R www-data:www-data /var/www/html
RUN chmod -R 755 /var/www/html
# Copy application code to the web root
COPY . /var/www/html
WORKDIR /var/www/html
# Clean up unnecessary files
RUN rm -rf DOCKERFILE
RUN rm -rf .gitignore
RUN rm -rf .git
RUN rm -rf .gitignore.bak
# Expose the new port
EXPOSE 8080
# Start Apache in the foreground
CMD ["apache2-foreground"]