@@ -3,14 +3,15 @@ FROM php:8.3-apache
33# Set working directory for build context
44WORKDIR /usr/src
55
6- # Install all dependencies including oniguruma
6+ # Combined installation and configuration
77RUN apt-get update && apt-get install -y \
88 wget make gcc g++ \
99 libjpeg-dev libpng-dev libwebp-dev zlib1g-dev \
1010 unzip git apache2-dev libxml2-dev \
1111 libsqlite3-dev pkg-config libzip-dev \
1212 libcurl4-openssl-dev ca-certificates \
1313 libonig-dev && \
14+ \
1415 # Build and install SQLite
1516 wget https://www.sqlite.org/2025/sqlite-autoconf-3490100.tar.gz && \
1617 tar xzf sqlite-autoconf-3490100.tar.gz && \
@@ -20,10 +21,12 @@ RUN apt-get update && apt-get install -y \
2021 make install && \
2122 cd .. && \
2223 rm -rf sqlite-autoconf-3490100* && \
24+ \
2325 # Update system SQLite
2426 cp /usr/local/bin/sqlite3 /usr/bin/sqlite3 && \
2527 cp /usr/local/lib/libsqlite3.so* /usr/lib/ && \
2628 ldconfig && \
29+ \
2730 # Rebuild PHP
2831 docker-php-source extract && \
2932 cd /usr/src/php && \
@@ -39,27 +42,38 @@ RUN apt-get update && apt-get install -y \
3942 make -j$(nproc) && \
4043 make install && \
4144 docker-php-source delete && \
45+ \
4246 # Install PHP extensions
4347 docker-php-ext-configure gd --with-jpeg --with-webp && \
4448 docker-php-ext-install gd curl mbstring && \
45- # Clean up
49+ \
50+ # Clean up build dependencies
4651 apt-get purge -y --auto-remove wget make gcc g++ && \
4752 apt-get clean && \
4853 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
49- # PHP config
54+ \
55+ # PHP configuration
5056 cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
5157 update-ca-certificates && \
5258 echo "allow_url_fopen = On" >> /usr/local/etc/php/conf.d/drupal.ini && \
5359 echo "openssl.cafile = /etc/ssl/certs/ca-certificates.crt" >> /usr/local/etc/php/conf.d/drupal.ini && \
54- # Apache config
60+ \
61+ # Apache configuration
5562 a2enmod rewrite && \
56- echo "DocumentRoot /var/www/web" > /etc/apache2/conf-available/document-root.conf && \
57- echo "<Directory /var/www/web>" >> /etc/apache2/conf-available/document-root.conf && \
58- echo " Options Indexes FollowSymLinks" >> /etc/apache2/conf-available/document-root.conf && \
59- echo " AllowOverride All" >> /etc/apache2/conf-available/document-root.conf && \
60- echo " Require all granted" >> /etc/apache2/conf-available/document-root.conf && \
61- echo "</Directory>" >> /etc/apache2/conf-available/document-root.conf && \
62- a2enconf document-root
63+ echo "<VirtualHost *:80>\n \
64+ DocumentRoot /var/www/web\n \
65+ <Directory /var/www/web>\n \
66+ Options -Indexes +FollowSymLinks\n \
67+ AllowOverride All\n \
68+ Require all granted\n \
69+ DirectoryIndex index.php\n \
70+ </Directory>\n \
71+ </VirtualHost>" > /etc/apache2/sites-available/000-default.conf && \
72+ rm -f /etc/apache2/sites-enabled/000-default.conf && \
73+ ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/ && \
74+ \
75+ # Final cleanup
76+ rm -rf /usr/src/*
6377
6478WORKDIR /var/www
6579COPY --chown=www-data:www-data web/ web/
@@ -69,7 +83,8 @@ COPY docker/entrypoint.sh /entrypoint.sh
6983RUN chmod +x /entrypoint.sh
7084
7185WORKDIR /var/www/web
72- ENV DRUPAL_DOCKER=1
86+ ENV APACHE_DOCUMENT_ROOT=/var/www/web \
87+ DRUPAL_DOCKER=1
7388
7489ENTRYPOINT ["/entrypoint.sh" ]
7590EXPOSE 80
0 commit comments