4get-apache/entrypoint.sh

31 lines
788 B
Bash
Raw Normal View History

2025-01-06 22:35:23 -05:00
#!/bin/sh
set -e
# Default PUID and PGID
DEFAULT_PUID=1001
DEFAULT_PGID=1001
DEFAULT_PORT=80
# Use provided PUID and PGID or fall back to defaults
PUID=${PUID:-$DEFAULT_PUID}
PGID=${PGID:-$DEFAULT_PGID}
PORT=${PORT:-$DEFAULT_PORT}
echo "Creating container user & group \"abc\" with UID: ${PUID} and GID: ${PGID}..."
groupadd -g $PGID abc
useradd -u $PUID -g abc -m abc
echo "Generating 4get data/config.php from env..."
php /gen_config.php
echo "Setting 4get file permissions..."
chown -R abc:abc /var/www/html/4get
chmod -R 771 /var/www/html/4get
echo "Changing port in /etc/apache2/httpd.conf to ${PORT}..."
sed -i "s/^Listen .*/Listen ${PORT}/" /etc/apache2/httpd.conf
echo "Starting apache2 webserver..."
echo "4get should be up and running! :)"
httpd -k start -D FOREGROUND