From 83b78ec6cafb8199cf89c44a563dd0a13bf7c904 Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 11 Oct 2024 13:42:52 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dockerfile Dockerfile.7 Dockerfile.8 rootfs/root/docker/setup/02-packages.sh rootfs/root/docker/setup/03-files.sh rootfs/root/docker/setup/05-custom.sh rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh --- Dockerfile | 9 +++++++++ Dockerfile.7 | 9 +++++++++ Dockerfile.8 | 9 +++++++++ rootfs/root/docker/setup/02-packages.sh | 5 +++-- rootfs/root/docker/setup/03-files.sh | 2 +- rootfs/root/docker/setup/05-custom.sh | 2 +- rootfs/usr/local/bin/entrypoint.sh | 6 +++--- rootfs/usr/local/etc/docker/functions/entrypoint.sh | 5 ++++- 8 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index bbb7cdf..67f48b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ ARG DEFAULT_FILE_DIR="/usr/local/share/template-files" ARG DEFAULT_DATA_DIR="/usr/local/share/template-files/data" ARG DEFAULT_CONF_DIR="/usr/local/share/template-files/config" ARG DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults" +ARG PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ARG USER="root" ARG SHELL_OPTS="set -e -o pipefail" @@ -31,6 +32,7 @@ ARG BUILD_VERSION="${BUILD_DATE}" FROM tianon/gosu:latest AS gosu FROM ${PULL_URL}:${DISTRO_VERSION} AS build ARG TZ +ARG PATH ARG USER ARG LICENSE ARG TIMEZONE @@ -57,6 +59,7 @@ ARG PACK_LIST="bash-completion git curl wget sudo unzip iproute2 ssmtp openssl j ENV ENV=~/.profile ENV SHELL="/bin/sh" +ENV PATH="${PATH}" ENV TZ="${TIMEZONE}" ENV TIMEZONE="${TZ}" ENV LANG="${LANGUAGE}" @@ -68,6 +71,10 @@ WORKDIR /root COPY ./rootfs/usr/local/bin/. /usr/local/bin/ +RUN set -e; \ + echo "Updating the system"; \ + pkmgr update + RUN set -e; \ echo "Setting up prerequisites"; \ apk add --no-cache bash @@ -178,6 +185,7 @@ RUN echo "Deleting unneeded files"; \ RUN echo "Init done" FROM scratch ARG TZ +ARG PATH ARG USER ARG TIMEZONE ARG LANGUAGE @@ -223,6 +231,7 @@ LABEL com.github.containers.toolbox="false" ENV ENV=~/.bashrc ENV USER="${USER}" +ENV PATH="${PATH}" ENV SHELL="/bin/bash" ENV TZ="${TIMEZONE}" ENV TIMEZONE="${TZ}" diff --git a/Dockerfile.7 b/Dockerfile.7 index c2a4573..94091d5 100644 --- a/Dockerfile.7 +++ b/Dockerfile.7 @@ -10,6 +10,7 @@ ARG DEFAULT_FILE_DIR="/usr/local/share/template-files" ARG DEFAULT_DATA_DIR="/usr/local/share/template-files/data" ARG DEFAULT_CONF_DIR="/usr/local/share/template-files/config" ARG DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults" +ARG PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ARG USER="root" ARG SHELL_OPTS="set -e -o pipefail" @@ -31,6 +32,7 @@ ARG BUILD_VERSION="${BUILD_DATE}" FROM tianon/gosu:latest AS gosu FROM ${PULL_URL}:${DISTRO_VERSION} AS build ARG TZ +ARG PATH ARG USER ARG LICENSE ARG TIMEZONE @@ -57,6 +59,7 @@ ARG PACK_LIST="bash-completion git curl wget sudo unzip iproute2 ssmtp openssl j ENV ENV=~/.profile ENV SHELL="/bin/sh" +ENV PATH="${PATH}" ENV TZ="${TIMEZONE}" ENV TIMEZONE="${TZ}" ENV LANG="${LANGUAGE}" @@ -68,6 +71,10 @@ WORKDIR /root COPY ./rootfs/usr/local/bin/. /usr/local/bin/ +RUN set -e; \ + echo "Updating the system"; \ + pkmgr update + RUN set -e; \ echo "Setting up prerequisites"; \ apk add --no-cache bash @@ -178,6 +185,7 @@ RUN echo "Deleting unneeded files"; \ RUN echo "Init done" FROM scratch ARG TZ +ARG PATH ARG USER ARG TIMEZONE ARG LANGUAGE @@ -223,6 +231,7 @@ LABEL com.github.containers.toolbox="false" ENV ENV=~/.bashrc ENV USER="${USER}" +ENV PATH="${PATH}" ENV SHELL="/bin/bash" ENV TZ="${TIMEZONE}" ENV TIMEZONE="${TZ}" diff --git a/Dockerfile.8 b/Dockerfile.8 index 681e046..e531bc9 100644 --- a/Dockerfile.8 +++ b/Dockerfile.8 @@ -10,6 +10,7 @@ ARG DEFAULT_FILE_DIR="/usr/local/share/template-files" ARG DEFAULT_DATA_DIR="/usr/local/share/template-files/data" ARG DEFAULT_CONF_DIR="/usr/local/share/template-files/config" ARG DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults" +ARG PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ARG USER="root" ARG SHELL_OPTS="set -e -o pipefail" @@ -31,6 +32,7 @@ ARG BUILD_VERSION="${BUILD_DATE}" FROM tianon/gosu:latest AS gosu FROM ${PULL_URL}:${DISTRO_VERSION} AS build ARG TZ +ARG PATH ARG USER ARG LICENSE ARG TIMEZONE @@ -57,6 +59,7 @@ ARG PACK_LIST="bash-completion git curl wget sudo unzip iproute2 ssmtp openssl j ENV ENV=~/.profile ENV SHELL="/bin/sh" +ENV PATH="${PATH}" ENV TZ="${TIMEZONE}" ENV TIMEZONE="${TZ}" ENV LANG="${LANGUAGE}" @@ -68,6 +71,10 @@ WORKDIR /root COPY ./rootfs/usr/local/bin/. /usr/local/bin/ +RUN set -e; \ + echo "Updating the system"; \ + pkmgr update + RUN set -e; \ echo "Setting up prerequisites"; \ apk add --no-cache bash @@ -178,6 +185,7 @@ RUN echo "Deleting unneeded files"; \ RUN echo "Init done" FROM scratch ARG TZ +ARG PATH ARG USER ARG TIMEZONE ARG LANGUAGE @@ -222,6 +230,7 @@ LABEL org.opencontainers.image.documentation="https://github.com/casjaysdevdocke LABEL com.github.containers.toolbox="false" ENV ENV=~/.bashrc +ENV PATH="${PATH}" ENV USER="${USER}" ENV SHELL="/bin/bash" ENV TZ="${TIMEZONE}" diff --git a/rootfs/root/docker/setup/02-packages.sh b/rootfs/root/docker/setup/02-packages.sh index 2516518..b42aca0 100755 --- a/rootfs/root/docker/setup/02-packages.sh +++ b/rootfs/root/docker/setup/02-packages.sh @@ -24,9 +24,10 @@ set -o pipefail # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set env variables exitCode=0 - +[ ! -f "/usr/local/etc/php-fpm.conf.default" ] || rm -Rf "/usr/local/etc/php-fpm.conf.default" +[ ! -f "/usr/local/etc/php-fpm.d/www.conf.default" ] || rm -Rf "/usr/local/etc/php-fpm.d/www.conf.default" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Predifined actions +# Predefined actions # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Main script diff --git a/rootfs/root/docker/setup/03-files.sh b/rootfs/root/docker/setup/03-files.sh index 8f0cf4d..ba552ad 100755 --- a/rootfs/root/docker/setup/03-files.sh +++ b/rootfs/root/docker/setup/03-files.sh @@ -56,7 +56,7 @@ if [ -d "/tmp/etc" ]; then echo "Installing $config to /etc/$name" if [ -d "$config" ]; then mkdir -p "/etc/$name" - copy "$config/." "/etc/$name/" + copy "$config/." "/usr/local/etc/$name/" mkdir -p "/usr/local/share/template-files/config/$name" copy "$config/." "/usr/local/share/template-files/config/$name/" else diff --git a/rootfs/root/docker/setup/05-custom.sh b/rootfs/root/docker/setup/05-custom.sh index b24f513..6389177 100755 --- a/rootfs/root/docker/setup/05-custom.sh +++ b/rootfs/root/docker/setup/05-custom.sh @@ -38,7 +38,7 @@ if [ -n "$EXT_INSTALLED" ]; then chmod +x "$BIN_DIR/install-php-extensions" for ext in $EXT_LIST $EXT_ADDITIONAL; do if ! echo "$ext" | grep -q "$EXT_INSTALLED"; then - install-php-extensions $ext + apk add --no-cache php-$ext || install-php-extensions $ext fi done else diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 13a398f..74d987c 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -12,8 +12,8 @@ # @@Description : Entrypoint file for php # @@Changelog : New script # @@TODO : Better documentation -# @@Other : -# @@Resource : +# @@Other : +# @@Resource : # @@Terminal App : no # @@sudo/root : no # @@Template : other/docker-entrypoint @@ -24,7 +24,7 @@ [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" +export PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set bash options SCRIPT_FILE="$0" diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index d2e1811..8e526f4 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -1058,7 +1058,9 @@ __initialize_ssl_certs() { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __start_php_dev_server() { local web_root="${1:-$WWW_ROOT_DIR}" - if [ -n "$PHP_DEV_SERVER_PORT" ] && [ "$2" = "yes" ]; then + local start_server="${2:-$PHP_DEV_SERVER_START}" + [ "$CONTAINER_NAME" = "php" ] && start_server="yes" + if [ -n "$PHP_DEV_SERVER_PORT" ] && [ "$start_server" = "yes" ]; then if ! echo "$web_root" | grep -q "^/usr/share/httpd"; then find "$web_root" -type f -not -path '.git*' -iname '*.php' -exec sed -i 's|[<].*SERVER_ADDR.*[>]|'${CONTAINER_IP4_ADDRESS:-127.0.0.1}'|g' {} \; 2>/dev/null php -S 0.0.0.0:$PHP_DEV_SERVER_PORT -t "$web_root" @@ -1153,6 +1155,7 @@ export LANG="${LANG:-C.UTF-8}" export LC_ALL="${LANG:-C.UTF-8}" export TZ="${TZ:-${TIMEZONE:-America/New_York}}" export HOSTNAME="${FULL_DOMAIN_NAME:-${SERVER_HOSTNAME:-$HOSTNAME}}" +export PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Default directories export SSL_DIR="${SSL_DIR:-/config/ssl}"