Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpine 3.20/PHP82 #45

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM alpine:3.19
MAINTAINER Matthew Horwood <[email protected]>

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/

RUN apk update \
&& apk add nginx php81-fpm php81-session \
php81-gd php81-mbstring php81-mysqli php81-openssl \
php81-xml php81-dom php81-intl php81-bcmath composer curl \
&& apk add nginx php82-fpm php82-session \
php82-gd php82-mbstring php82-mysqli php82-openssl \
php82-xml php82-dom php82-intl php82-bcmath composer curl \
&& rm -f /var/cache/apk/* \
&& mkdir -p /var/www/html/ \
&& mkdir -p /run/nginx;
&& mkdir -p /run/nginx; \
[ -f /usr/bin/php ] && rm -f /usr/bin/php; \
ln -s /usr/bin/php82 /usr/bin/php;

ENV IP_SOURCE="https://github.com/InvoicePlane/InvoicePlane/releases/download" \

Check warning on line 14 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MYSQL_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
IP_VERSION="v1.6.1" \
MYSQL_HOST="mysql" \
MYSQL_USER="root" \
Expand All @@ -27,8 +29,8 @@
unzip /tmp/${IP_VERSION}.zip && \
cp -r ip/* /var/www/html/ && \
chmod +x /config/start.sh; \
cp /config/php.ini /etc/php81/php.ini && \
cp /config/php_fpm_site.conf /etc/php81/php-fpm.d/www.conf; \
cp /config/php.ini /etc/php82/php.ini && \
cp /config/php_fpm_site.conf /etc/php82/php-fpm.d/www.conf; \
cp /config/nginx_site.conf /etc/nginx/http.d/default.conf; \
chown nobody:nginx /var/www/html/* -R;

Expand Down
12 changes: 7 additions & 5 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ FROM alpine:3.17
MAINTAINER Matthew Horwood <[email protected]>

RUN apk update \
&& apk add nginx php81-fpm \
php81-gd php81-mbstring php81-mysqli php81-openssl \
php81-xml php81-intl php81-bcmath composer curl \
&& apk add nginx php82-fpm \
php82-gd php82-mbstring php82-mysqli php82-openssl \
php82-xml php82-intl php82-bcmath composer curl \
&& rm -f /var/cache/apk/* \
&& mkdir -p /var/www/html/ \
&& mkdir -p /run/nginx;
&& mkdir -p /run/nginx; \
[ -f /usr/bin/php ] && rm -f /usr/bin/php; \
ln -s /usr/bin/php82 /usr/bin/php;

ENV IP_SOURCE="https://github.com/InvoicePlane/InvoicePlane/releases/download" \
IP_VERSION="v1.6.0" \
IP_VERSION="v1.6.1" \
MYSQL_HOST="mysql" \
MYSQL_USER="root" \
MYSQL_PASSWORD="my-secret-pw" \
Expand Down
36 changes: 18 additions & 18 deletions setup/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

ln -s /dev/stdout /var/log/php81/error.log
ln -s /dev/stdout /var/log/php82/error.log
ln -s /dev/stdout /var/log/nginx/access.log
ln -s /dev/stdout /var/log/nginx/error.log

Expand All @@ -10,34 +10,34 @@ then
cp /var/www/html/ipconfig.php.example /var/www/html/ipconfig.php
fi

[ -n "$IP_URL" ] && sed -i -e "s!IP_URL=!IP_URL=${IP_URL}!" /var/www/html/ipconfig.php
[ -n "$ENABLE_DEBUG" ] && sed -i -e "s/ENABLE_DEBUG=.*/ENABLE_DEBUG=${ENABLE_DEBUG}/" /var/www/html/ipconfig.php
[ -n "$DISABLE_SETUP" ] && sed -i -e "s/DISABLE_SETUP=.*/DISABLE_SETUP=${DISABLE_SETUP}/" /var/www/html/ipconfig.php
[ -n "$REMOVE_INDEXPHP" ] && sed -i -e "s/REMOVE_INDEXPHP=.*/REMOVE_INDEXPHP=${REMOVE_INDEXPHP}/" /var/www/html/ipconfig.php
[ -n "$IP_URL" ] && sed -i -e "s!^IP_URL=\$!IP_URL=${IP_URL}!" /var/www/html/ipconfig.php;
[ -n "$ENABLE_DEBUG" ] && sed -i -e "s/ENABLE_DEBUG=.*/ENABLE_DEBUG=${ENABLE_DEBUG}/" /var/www/html/ipconfig.php;
[ -n "$DISABLE_SETUP" ] && sed -i -e "s/DISABLE_SETUP=.*/DISABLE_SETUP=${DISABLE_SETUP}/" /var/www/html/ipconfig.php;
[ -n "$REMOVE_INDEXPHP" ] && sed -i -e "s/REMOVE_INDEXPHP=.*/REMOVE_INDEXPHP=${REMOVE_INDEXPHP}/" /var/www/html/ipconfig.php;

[ -n "$MYSQL_HOST" ] && sed -i -e "s/DB_HOSTNAME=/DB_HOSTNAME=${MYSQL_HOST}/" /var/www/html/ipconfig.php
[ -n "$MYSQL_USER" ] && sed -i -e "s/DB_USERNAME=/DB_USERNAME=${MYSQL_USER}/" /var/www/html/ipconfig.php
[ -n "$MYSQL_PASSWORD" ] && sed -i -e "s/DB_PASSWORD=/DB_PASSWORD=${MYSQL_PASSWORD}/" /var/www/html/ipconfig.php
[ -n "$MYSQL_DB" ] && sed -i -e "s/DB_DATABASE=/DB_DATABASE=${MYSQL_DB}/" /var/www/html/ipconfig.php
[ -n "$MYSQL_PORT" ] && sed -i -e "s/DB_PORT=/DB_PORT=${MYSQL_PORT}/" /var/www/html/ipconfig.php
[ -n "$MYSQL_HOST" ] && sed -i -e "s/^DB_HOSTNAME=$/DB_HOSTNAME=${MYSQL_HOST}/" /var/www/html/ipconfig.php;
[ -n "$MYSQL_USER" ] && sed -i -e "s/^DB_USERNAME=$/DB_USERNAME=${MYSQL_USER}/" /var/www/html/ipconfig.php;
[ -n "$MYSQL_PASSWORD" ] && sed -i -e "s/^DB_PASSWORD=$/DB_PASSWORD=${MYSQL_PASSWORD}/" /var/www/html/ipconfig.php;
[ -n "$MYSQL_DB" ] && sed -i -e "s/^DB_DATABASE=$/DB_DATABASE=${MYSQL_DB}/" /var/www/html/ipconfig.php;
[ -n "$MYSQL_PORT" ] && sed -i -e "s/^DB_PORT=$/DB_PORT=${MYSQL_PORT}/" /var/www/html/ipconfig.php;

[ -n "$SESS_EXPIRATION" ] && sed -i -e "s/SESS_EXPIRATION=/SESS_EXPIRATION=${SESS_EXPIRATION}/" /var/www/html/ipconfig.php
[ -n "$SESS_MATCH_IP" ] && sed -i -e "s/SESS_MATCH_IP=/SESS_MATCH_IP=${SESS_MATCH_IP}/" /var/www/html/ipconfig.php
[ -n "$ENABLE_INVOICE_DELETION" ] && sed -i -e "s/ENABLE_INVOICE_DELETION=/ENABLE_INVOICE_DELETION=${ENABLE_INVOICE_DELETION}/" /var/www/html/ipconfig.php
[ -n "$DISABLE_READ_ONLY" ] && sed -i -e "s/DISABLE_READ_ONLY=/DISABLE_READ_ONLY=${DISABLE_READ_ONLY}/" /var/www/html/ipconfig.php
[ -n "$SESS_EXPIRATION" ] && sed -i -e "s/^SESS_EXPIRATION=$/SESS_EXPIRATION=${SESS_EXPIRATION}/" /var/www/html/ipconfig.php;
[ -n "$SESS_MATCH_IP" ] && sed -i -e "s/^SESS_MATCH_IP=$/SESS_MATCH_IP=${SESS_MATCH_IP}/" /var/www/html/ipconfig.php;
[ -n "$ENABLE_INVOICE_DELETION" ] && sed -i -e "s/^ENABLE_INVOICE_DELETION=$/ENABLE_INVOICE_DELETION=${ENABLE_INVOICE_DELETION}/" /var/www/html/ipconfig.php;
[ -n "$DISABLE_READ_ONLY" ] && sed -i -e "s/^DISABLE_READ_ONLY=$/DISABLE_READ_ONLY=${DISABLE_READ_ONLY}/" /var/www/html/ipconfig.php;

### CRITICAL
if [ -n "$SETUP_COMPLETED" ]; then
[ -n "$ENCRYPTION_KEY" ] && sed -i -e "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=${ENCRYPTION_KEY}/" /var/www/html/ipconfig.php
[ -n "$ENCRYPTION_CIPHER" ] && sed -i -e "s/ENCRYPTION_CIPHER=.*/ENCRYPTION_CIPHER=${ENCRYPTION_CIPHER}/" /var/www/html/ipconfig.php
sed -i -e "s/SETUP_COMPLETED=.*/SETUP_COMPLETED=${SETUP_COMPLETED}/" /var/www/html/ipconfig.php
[ -n "$ENCRYPTION_KEY" ] && sed -i -e "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=${ENCRYPTION_KEY}/" /var/www/html/ipconfig.php;
[ -n "$ENCRYPTION_CIPHER" ] && sed -i -e "s/ENCRYPTION_CIPHER=.*/ENCRYPTION_CIPHER=${ENCRYPTION_CIPHER}/" /var/www/html/ipconfig.php;
sed -i -e "s/SETUP_COMPLETED=.*/SETUP_COMPLETED=${SETUP_COMPLETED}/" /var/www/html/ipconfig.php;
fi

chown nobody:nginx /var/www/html/ipconfig.php;
chown -R nobody:nginx /var/www/html/uploads;
chown -R nobody:nginx /var/www/html/assets/core/css;
chown -R nobody:nginx /var/www/html/application/views;

php-fpm81
php-fpm82

exec "$@"