2022-05-18 21:01:19 +02:00
|
|
|
FROM php:8-apache
|
|
|
|
|
|
|
|
# Install OS dependencies required
|
|
|
|
RUN apt-get update && apt-get upgrade -y && apt-get install git unzip zlib1g-dev libpng-dev -y
|
|
|
|
|
|
|
|
# Adapt apache config
|
|
|
|
RUN a2enmod rewrite \
|
|
|
|
&& echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf
|
|
|
|
|
|
|
|
# Install PHP ext-gd
|
|
|
|
RUN docker-php-ext-install gd
|
|
|
|
|
|
|
|
COPY docker-utils /usr/local/bin
|
|
|
|
|
2022-05-18 22:04:02 +02:00
|
|
|
#WORKDIR /src
|
|
|
|
#
|
|
|
|
#COPY system ./system
|
|
|
|
#COPY .htaccess \
|
|
|
|
# composer* \
|
|
|
|
# index.php \
|
|
|
|
# /src/
|
|
|
|
#COPY cache ./cache
|
|
|
|
#COPY data ./data
|
|
|
|
#COPY media ./media
|
|
|
|
#COPY settings ./settings
|
|
|
|
#COPY themes ./themes
|
|
|
|
|
|
|
|
#WORKDIR /tmp
|
|
|
|
#
|
|
|
|
#COPY content ./content
|
|
|
|
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
COPY . /src/
|
|
|
|
COPY . .
|
2022-05-18 21:01:19 +02:00
|
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/install-composer && \
|
|
|
|
/usr/local/bin/install-composer && \
|
|
|
|
./composer.phar update && \
|
2022-05-18 22:04:02 +02:00
|
|
|
chmod +x /usr/local/bin/init-server
|
|
|
|
# chmod +x /usr/local/bin/adjust-rights && \
|
|
|
|
# /usr/local/bin/adjust-rights
|
2022-05-18 21:01:19 +02:00
|
|
|
|
2022-05-18 22:31:24 +02:00
|
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
|
|
&& find /var/www/html -type d -exec chmod 570 {} \; \
|
|
|
|
&& find /var/www/html -type f -exec chmod 460 {} \;
|
|
|
|
RUN cp -R /var/www/html/content /var/www/html/content.orig
|
|
|
|
COPY cmd.sh /
|
|
|
|
COPY init_content.sh /
|
|
|
|
RUN chown root:root /cmd.sh ; chmod 0700 /cmd.sh
|
|
|
|
RUN chown root:root /init_content.sh ; chmod 0700 /init_content.sh
|
|
|
|
CMD ["/cmd.sh"]
|
2022-05-18 21:01:19 +02:00
|
|
|
|
|
|
|
# Create a non-root user to own the files and run our server
|
2022-05-18 22:04:02 +02:00
|
|
|
#WORKDIR /var/www/html
|
2022-05-18 21:01:19 +02:00
|
|
|
|
|
|
|
# Expose single volume of data to simplify maintenance
|
2022-05-18 22:04:02 +02:00
|
|
|
#VOLUME /var/www/html/content
|
2022-05-18 21:01:19 +02:00
|
|
|
|
|
|
|
#RUN cp -R /src/* /var/www/html/
|
|
|
|
#RUN cp -R /tmp/* /var/www/html/
|
|
|
|
#ARG UNAME=www-data
|
|
|
|
#ARG UGROUP=www-data
|
|
|
|
#ENV UID=1000
|
|
|
|
#ENV GID=1000
|
|
|
|
#RUN usermod --uid $UID $UNAME && \
|
|
|
|
# groupmod --gid $GID $UGROUP
|
|
|
|
|
|
|
|
# Install PHP dependencies
|
|
|
|
#RUN /usr/local/bin/install-composer && \
|
|
|
|
# ./composer.phar update && \
|
|
|
|
# rm -rf composer* Dockerfile docker-utils/install-composer
|
|
|
|
#
|
|
|
|
## Adjust rights for www-data, a non-root user, to own the files and run our server
|
|
|
|
#RUN /usr/local/bin/adjust-rights && \
|
|
|
|
# rm -rf Dockerfile
|
|
|
|
|
|
|
|
|
|
|
|
#RUN sed -i 's/^exec /chown www-data:www-data \/var\/www\/html/\n\nexec /' /usr/local/bin/apache2-foreground
|
|
|
|
#
|
|
|
|
### Use our non-root user
|
|
|
|
#RUN chown -R www-data:www-data /var/www/html/
|
|
|
|
#USER www-data
|
|
|
|
|
|
|
|
# Run the server
|
2022-05-18 22:31:24 +02:00
|
|
|
#CMD ["/usr/local/bin/init-server"]
|