feat(config): move PHP configuration from runtime to build time

This commit is the second of a PR that will
aim at dropping requirement to run containers
with root permissions.

This commit leverages env vars rather than sed &
dynamic environment substitution for php.ini file.
This commit is contained in:
Théotime Lévêque 2023-12-22 15:24:25 +01:00 committed by thylong
parent 60ea64a7db
commit 52f17a764c
No known key found for this signature in database
GPG key ID: 2708316F958DBF44
4 changed files with 14 additions and 12 deletions

View file

@ -40,6 +40,7 @@ RUN apk --no-cache --update \
COPY linkstack /htdocs
COPY configs/apache2/httpd.conf /etc/apache2/httpd.conf
COPY configs/apache2/ssl.conf /etc/apache2/conf.d/ssl.conf
COPY configs/php/php.ini /etc/php8.2/php.ini
RUN chown -R apache:apache /htdocs
RUN find /htdocs -type d -print0 | xargs -0 chmod 0755
@ -80,4 +81,4 @@ RUN sed -i 's/#LoadModule deflate_module/LoadModule deflate_module/' /etc/apache
# Set console entry path
WORKDIR /htdocs
CMD ["docker-entrypoint.sh"]
CMD ["docker-entrypoint.sh"]

0
configs/php/php.ini Normal file
View file

View file

@ -1,7 +1,6 @@
version: "3.8"
services:
linkstack:
hostname: 'linkstack'
image: 'linkstackorg/linkstack:latest'
@ -16,10 +15,19 @@ services:
volumes:
- 'linkstack_data:/htdocs'
ports:
- '8188:80'
- '8190:443'
- '8080:80'
- '8081:443'
depends_on:
- mysql
links:
- mysql
restart: unless-stopped
mysql:
image: mysql:8
environment:
MYSQL_ROOT_PASSWORD: xeFgUGb5mPPn5q2d
ports:
- 3306:3306
volumes:
linkstack_data:

View file

@ -63,13 +63,6 @@ echo '| Updating Configuration: PHP (/etc/php82/php.ini) |'
if [[ ${DEBUG} == "TRUE" && -d /debug ]]; then cp /etc/php82/php.ini /debug/php.BEFORE.ini;fi
# ALTER: Modify php memory limit and timezone
sed -i "s/memory_limit = .*/memory_limit = ${PHP_MEMORY_LIMIT}/" /etc/php82/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = ${UPLOAD_MAX_FILESIZE}/" /etc/php82/php.ini
sed -i "s#^;date.timezone =\$#date.timezone = \"${TZ}\"#" /etc/php82/php.ini
echo "is_llc_docker = true" >> /etc/php82/php.ini
if [[ ${DEBUG} == "TRUE" && -d /debug ]]; then cp /etc/php82/php.ini /debug/php.AFTER.ini;fi
# + ---------- + #