Add control for UID and GID
This commit is contained in:
@@ -30,7 +30,8 @@ RUN apk --no-cache add \
|
|||||||
${PHP_VER}-tokenizer \
|
${PHP_VER}-tokenizer \
|
||||||
${PHP_VER}-xmlwriter \
|
${PHP_VER}-xmlwriter \
|
||||||
${PHP_VER}-zip \
|
${PHP_VER}-zip \
|
||||||
${PHP_VER}-zlib && \
|
${PHP_VER}-zlib \
|
||||||
|
shadow && \
|
||||||
mkdir -p \
|
mkdir -p \
|
||||||
/app \
|
/app \
|
||||||
/run/nginx \
|
/run/nginx \
|
||||||
@@ -50,6 +51,7 @@ RUN apk --no-cache add yarn && \
|
|||||||
tar -xzvf panel.tar.gz && \
|
tar -xzvf panel.tar.gz && \
|
||||||
rm panel.tar.gz && \
|
rm panel.tar.gz && \
|
||||||
chmod -R 755 storage/* bootstrap/cache && \
|
chmod -R 755 storage/* bootstrap/cache && \
|
||||||
|
rm -rf /app/storage/logs && \
|
||||||
find storage -type d > .storage.tmpl && \
|
find storage -type d > .storage.tmpl && \
|
||||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
||||||
cp .env.example .env && \
|
cp .env.example .env && \
|
||||||
@@ -58,7 +60,7 @@ RUN apk --no-cache add yarn && \
|
|||||||
yarn install --production && \
|
yarn install --production && \
|
||||||
yarn add cross-env && \
|
yarn add cross-env && \
|
||||||
yarn run build:production && \
|
yarn run build:production && \
|
||||||
rm -rf node_modules .env ./storage
|
rm -rf node_modules .env storage
|
||||||
|
|
||||||
FROM base AS release
|
FROM base AS release
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@@ -24,6 +24,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
DBHOST: "db"
|
DBHOST: "db"
|
||||||
REDISHOST: "redis"
|
REDISHOST: "redis"
|
||||||
|
PUID: 1000
|
||||||
|
PGID: 1000
|
||||||
volumes:
|
volumes:
|
||||||
- "~/config/Pterodactyl/Panel:/config"
|
- "~/config/Pterodactyl/Panel:/config"
|
||||||
ports:
|
ports:
|
||||||
|
@@ -4,6 +4,17 @@ source ContainerTools
|
|||||||
SNAME=${0##*/}
|
SNAME=${0##*/}
|
||||||
WORKDIR="/app"
|
WORKDIR="/app"
|
||||||
|
|
||||||
|
# Set user and group IDs
|
||||||
|
if [ -n "$PUID" ]; then
|
||||||
|
log "Setting User ID for nginx to $PUID"
|
||||||
|
usermod -o -u "$PUID" nginx
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$PGID" ]; then
|
||||||
|
log "Setting Group ID for nginx to $PGID"
|
||||||
|
groupmod -o -g "$PGID" nginx
|
||||||
|
fi
|
||||||
|
|
||||||
# If DBHOST value is present, pause boot until target container is up.
|
# If DBHOST value is present, pause boot until target container is up.
|
||||||
if [ -n "$DBHOST" ]; then
|
if [ -n "$DBHOST" ]; then
|
||||||
log "Waiting for SQL at $DBHOST:${DBPORT:=3306}"
|
log "Waiting for SQL at $DBHOST:${DBPORT:=3306}"
|
||||||
@@ -32,6 +43,7 @@ if [ ! -d "/config/storage" ]; then
|
|||||||
cat $WORKDIR/.storage.tmpl | while read line; do
|
cat $WORKDIR/.storage.tmpl | while read line; do
|
||||||
mkdir -p "/config/${line}"
|
mkdir -p "/config/${line}"
|
||||||
done
|
done
|
||||||
|
ln -s /config/logs/panel $WORKDIR/storage/logs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for persistent Nginx logging directory, create file path if not present.
|
# Check for persistent Nginx logging directory, create file path if not present.
|
||||||
@@ -46,6 +58,12 @@ if [ ! -d "/config/logs/php" ]; then
|
|||||||
mkdir -p "/config/logs/php"
|
mkdir -p "/config/logs/php"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for persistent Panel logging directory, create file path if not present.
|
||||||
|
if [ ! -d "/config/logs/panel" ]; then
|
||||||
|
log "Creating PHP log directory."
|
||||||
|
mkdir -p "/config/logs/panel"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for config file, create template if not present.
|
# Check for config file, create template if not present.
|
||||||
if [ ! -e /config/pterodactyl.conf ]; then
|
if [ ! -e /config/pterodactyl.conf ]; then
|
||||||
log "Config file does not exist, creating template"
|
log "Config file does not exist, creating template"
|
||||||
@@ -79,4 +97,9 @@ else
|
|||||||
log "HTTP Nginx config file is already in place"
|
log "HTTP Nginx config file is already in place"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setting permissions for /config
|
||||||
|
log "Making sure permission for config folder are correct"
|
||||||
|
chown -R nginx:nginx /config
|
||||||
|
|
||||||
log "Initialization complete"
|
log "Initialization complete"
|
||||||
|
Reference in New Issue
Block a user