From 627b404081a96f36103d454c7d5a928777566a0e Mon Sep 17 00:00:00 2001 From: siane Date: Fri, 26 Dec 2025 11:36:55 +0900 Subject: [PATCH] Update 8.4/entrypoint.sh --- 8.4/entrypoint.sh | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/8.4/entrypoint.sh b/8.4/entrypoint.sh index c10679b..29de1ed 100644 --- a/8.4/entrypoint.sh +++ b/8.4/entrypoint.sh @@ -1,15 +1,40 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -Eeuo pipefail -# www-data 권한 정리 (카페24와 유사) -chown -R www-data:www-data /var/www/html +if [[ -n "${PUID}" ]] +then + usermod -u ${PUID} www-data +fi +if [[ -n "${PGID}" ]] +then + groupmod -g ${PGID} www-data +fi + +if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then + uid="$(id -u)" + gid="$(id -g)" + if [ "$uid" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$uid" + group="$gid" + fi -# index.php 없으면 테스트용 생성 -if [ ! -f /var/www/html/index.php ]; then -cat <<'EOF' > /var/www/html/index.php -