chore: prepare repo for use with Docker
This commit is contained in:
parent
33f8586698
commit
b9d217eb5f
2 changed files with 85 additions and 0 deletions
64
Dockerfile
Normal file
64
Dockerfile
Normal file
|
@ -0,0 +1,64 @@
|
|||
FROM debian:12-slim
|
||||
ADD . /opt/lwb5
|
||||
RUN <<EOF
|
||||
set -e
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
apt-get update && apt-get dist-upgrade -uy
|
||||
apt-get -y install lsb-release ca-certificates curl
|
||||
curl -sSLo /tmp/debsuryorg-archive-keyring.deb \
|
||||
https://packages.sury.org/debsuryorg-archive-keyring.deb
|
||||
dpkg -i /tmp/debsuryorg-archive-keyring.deb
|
||||
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" \
|
||||
> /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
apt-get install -y apache2 libapache2-mod-php8.3 \
|
||||
php8.3-cli php8.3-opcache php8.3-pgsql \
|
||||
php8.3-xml socat
|
||||
a2dismod mpm_event
|
||||
a2enmod mpm_prefork
|
||||
adduser --system --group \
|
||||
--shell '/usr/bin/php /opt/lwb5/scripts/ticks.php' \
|
||||
--comment 'LWB5 Ticks' \
|
||||
--home /opt/lwb5 --no-create-home \
|
||||
lwticks
|
||||
/bin/echo -e "Listen 80\nListen 81" > /etc/apache2/ports.conf
|
||||
cat > /etc/apache2/sites-available/lwb5-main.conf <<EOC
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /opt/lwb5/site
|
||||
ErrorLog /dev/stderr
|
||||
CustomLog /dev/stdout combined
|
||||
<Directory /opt/lwb5/site>
|
||||
Require all granted
|
||||
php_flag log_errors on
|
||||
php_value error_log syslog
|
||||
</Directory>
|
||||
<Files "*.inc">
|
||||
Require all denied
|
||||
</Files>
|
||||
</VirtualHost>
|
||||
EOC
|
||||
cat > /etc/apache2/sites-available/lwb5-admin.conf <<EOC
|
||||
<VirtualHost *:81>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /opt/lwb5/admin
|
||||
ErrorLog /dev/stderr
|
||||
CustomLog /dev/stdout combined
|
||||
<Directory /opt/lwb5/admin>
|
||||
Require all granted
|
||||
php_flag log_errors on
|
||||
php_value error_log syslog
|
||||
</Directory>
|
||||
<Files "*.inc">
|
||||
Require all denied
|
||||
</Files>
|
||||
</VirtualHost>
|
||||
EOC
|
||||
a2dissite 000-default
|
||||
a2ensite lwb5-main
|
||||
a2ensite lwb5-admin
|
||||
EOF
|
||||
|
||||
EXPOSE 80 81
|
||||
ENTRYPOINT ["/opt/lwb5/run-lwb5.sh"]
|
21
run-lwb5.sh
Executable file
21
run-lwb5.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
socat -u \
|
||||
UNIX-LISTEN:/dev/log,reuseaddr,mode=666,fork \
|
||||
SYSTEM:"(sed -z 's/$/\\\\n/'; /bin/echo)" \
|
||||
&
|
||||
|
||||
#perl /opt/lwb5/scripts/control.pl --start
|
||||
#perl /opt/lwb5/scripts/control.pl TMINIT
|
||||
|
||||
: "${APACHE_CONFDIR:=/etc/apache2}"
|
||||
: "${APACHE_RUN_DIR:=/run/apache2}"
|
||||
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
|
||||
: "${APACHE_LOG_DIR:=/var/log/apache2}"
|
||||
: "${APACHE_RUN_USER:=www-data}"
|
||||
: "${APACHE_RUN_GROUP:=www-data}"
|
||||
rm -f "$APACHE_PID_FILE"
|
||||
|
||||
export APACHE_CONFDIR APACHE_RUN_DIR APACHE_PID_FILE \
|
||||
APACHE_LOG_DIR APACHE_RUN_USER APACHE_RUN_GROUP
|
||||
exec /usr/sbin/apache2 -DFOREGROUND "$@"
|
Loading…
Reference in a new issue