Compare commits

..

10 Commits

Author SHA1 Message Date
f1b3861b54 Fix missed references, simplify future upgrades
All checks were successful
Build on Commit / build-and-push-image (push) Successful in 2m38s
2024-05-30 13:59:31 -05:00
6b810a5036 Update PHP version 2024-05-29 15:59:11 -05:00
32f411cd48 Reverting and re-testing 2024-03-01 14:31:52 -06:00
60adf6c0f8 Paths-Ignore seems to be working after all 2024-03-01 14:31:18 -06:00
6a78dc986d Testing with dockerfile 2024-03-01 14:29:49 -06:00
16f00bd136 Testing with runner action 2024-03-01 14:29:15 -06:00
6ef72e9a64 Testing again 2024-03-01 14:28:01 -06:00
a34b562527 Add automated build task 2024-03-01 13:50:53 -06:00
7b1cf05fe8 Add control for UID and GID 2024-01-23 18:44:05 -06:00
17107bd7bb Reconfigure to run out of /app directory 2024-01-23 16:34:37 -06:00
11 changed files with 92 additions and 54 deletions

View File

@@ -5,8 +5,10 @@ on:
push:
branches:
- "main"
# schedule:
# - cron: "37 18 * * *"
paths-ignore:
- ".gitea/**"
schedule:
- cron: "0 0 * * 0"
env:
REGISTRY: gitea.taco.quest
@@ -27,6 +29,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

View File

@@ -1,48 +1,45 @@
FROM alpine AS base
ENV PHP_VER="php81" \
PHPFPM_VER="php-fpm81" \
ENV PHP_VER="83" \
NODE_OPTIONS=--openssl-legacy-provider
RUN apk --no-cache add \
bash \
curl \
nginx \
${PHP_VER} \
${PHP_VER}-bcmath \
${PHP_VER}-common \
${PHP_VER}-ctype \
${PHP_VER}-dom \
${PHP_VER}-fileinfo \
${PHP_VER}-fpm \
${PHP_VER}-gd \
${PHP_VER}-mbstring \
${PHP_VER}-pecl-memcached \
${PHP_VER}-openssl \
${PHP_VER}-pdo \
${PHP_VER}-pdo_mysql \
${PHP_VER}-phar \
${PHP_VER}-posix \
${PHP_VER}-json \
${PHP_VER}-session \
${PHP_VER}-simplexml \
${PHP_VER}-sodium \
${PHP_VER}-tokenizer \
${PHP_VER}-xmlwriter \
${PHP_VER}-zip \
${PHP_VER}-zlib && \
rm -rf /var/www/localhost && \
php${PHP_VER} \
php${PHP_VER}-bcmath \
php${PHP_VER}-common \
php${PHP_VER}-ctype \
php${PHP_VER}-dom \
php${PHP_VER}-fileinfo \
php${PHP_VER}-fpm \
php${PHP_VER}-gd \
php${PHP_VER}-mbstring \
php${PHP_VER}-pecl-memcached \
php${PHP_VER}-openssl \
php${PHP_VER}-pdo \
php${PHP_VER}-pdo_mysql \
php${PHP_VER}-phar \
php${PHP_VER}-posix \
php${PHP_VER}-json \
php${PHP_VER}-session \
php${PHP_VER}-simplexml \
php${PHP_VER}-sodium \
php${PHP_VER}-tokenizer \
php${PHP_VER}-xmlwriter \
php${PHP_VER}-zip \
php${PHP_VER}-zlib \
shadow && \
mkdir -p \
/var/www/pterodactyl \
/app \
/run/nginx \
/run/php-fpm && \
ln -s /etc/${PHP_VER} /etc/php && \
ln -s /usr/bin/${PHP_VER} /usr/bin/php && \
ln -s /usr/sbin/${PHPFPM_VER} /usr/sbin/php-fpm && \
ln -s /var/log/${PHP_VER} /var/log/php
ln -s /etc/php${PHP_VER} /etc/php && \
ln -s /usr/sbin/php-fpm${PHP_VER} /usr/sbin/php-fpm
FROM base AS build
WORKDIR /var/www/pterodactyl
WORKDIR /app
# Download latest Panel build from project repository: https://github.com/pterodactyl/panel
ADD https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz panel.tar.gz
@@ -52,6 +49,7 @@ RUN apk --no-cache add yarn && \
tar -xzvf panel.tar.gz && \
rm panel.tar.gz && \
chmod -R 755 storage/* bootstrap/cache && \
rm -rf /app/storage/logs && \
find storage -type d > .storage.tmpl && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
cp .env.example .env && \
@@ -60,14 +58,14 @@ RUN apk --no-cache add yarn && \
yarn install --production && \
yarn add cross-env && \
yarn run build:production && \
rm -rf node_modules .env ./storage
rm -rf node_modules .env storage
FROM base AS release
WORKDIR /var/www/pterodactyl
WORKDIR /app
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2"
# Copy built Panel from Build stage
COPY --from=build --chown=nginx:nginx /var/www /var/www
COPY --from=build --chown=nginx:nginx /app /app
COPY root/ /
# Download latest S6-Overlay components from project repository: https://github.com/just-containers/s6-overlay
@@ -88,7 +86,7 @@ RUN chmod u+x /usr/local/bin/wait-for-it /etc/s6-overlay/scripts/initializer &&
rm -rf \
/tmp/* \
/etc/nginx/http.d/default.conf \
/etc/${PHP_VER}/php-fpm.d/www.conf && \
/etc/php${PHP_VER}/php-fpm.d/www.conf && \
# Symlink storage and conf file
ln -s /config/storage storage && \
ln -s /config/pterodactyl.conf .env
@@ -97,4 +95,4 @@ RUN chmod u+x /usr/local/bin/wait-for-it /etc/s6-overlay/scripts/initializer &&
VOLUME [ "/config" ]
# Set entrypoint to S6-Overlay
ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/init" ]

View File

@@ -24,6 +24,8 @@ services:
environment:
DBHOST: "db"
REDISHOST: "redis"
PUID: 1000
PGID: 1000
volumes:
- "~/config/Pterodactyl/Panel:/config"
ports:

View File

@@ -7,7 +7,7 @@ server {
server_name _;
root /var/www/pterodactyl/public;
root /app/public;
index index.php;
charset utf-8;
@@ -19,7 +19,7 @@ server {
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error;
error_log /config/logs/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;

View File

@@ -13,11 +13,11 @@ server {
listen 443 ssl http2;
server_name _;
root /var/www/pterodactyl/public;
root /app/public;
index index.php;
access_log /var/log/nginx/pterodactyl.app-access.log;
error_log /var/log/nginx/pterodactyl.app-error.log error;
access_log /config/logs/nginx/pterodactyl.app-access.log;
error_log /config/logs/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;

View File

@@ -1 +1 @@
* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1
* * * * * php /app/artisan schedule:run >> /dev/null 2>&1

View File

@@ -1,7 +1,7 @@
user nginx;
worker_processes auto;
pcre_jit on;
error_log /var/log/nginx/error.log warn;
error_log /config/logs/nginx/error.log warn;
include /etc/nginx/modules/*.conf;
events {
@@ -39,6 +39,6 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
access_log /config/logs/nginx/access.log main;
include /etc/nginx/http.d/*.conf;
}

View File

@@ -1,5 +1,5 @@
[global]
pid = /run/php-fpm/php-fpm.pid
error_log = /var/log/php/error.log
error_log = /config/logs/php/error.log
log_level = warning
include=/etc/php/php-fpm.d/*.conf

View File

@@ -1,4 +1,4 @@
#!/command/with-contenv bash
s6-setuidgid nginx
/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
/usr/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3

View File

@@ -2,7 +2,18 @@
source ContainerTools
SNAME=${0##*/}
WORKDIR="/var/www/pterodactyl"
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 [ -n "$DBHOST" ]; then
@@ -32,12 +43,25 @@ if [ ! -d "/config/storage" ]; then
cat $WORKDIR/.storage.tmpl | while read line; do
mkdir -p "/config/${line}"
done
ln -s /config/logs/panel $WORKDIR/storage/logs
fi
# Check for persistent logging directory, create file path if not present.
if [ ! -d "/config/log/nginx" ]; then
log "Creating log directory."
mkdir -p "/config/log/nginx"
# Check for persistent Nginx logging directory, create file path if not present.
if [ ! -d "/config/logs/nginx" ]; then
log "Creating Nginx log directory."
mkdir -p "/config/logs/nginx"
fi
# Check for persistent PHP logging directory, create file path if not present.
if [ ! -d "/config/logs/php" ]; then
log "Creating PHP log directory."
mkdir -p "/config/logs/php"
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.
@@ -62,11 +86,20 @@ if [ "$HTTPS" == "true" ]; then
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
log "Symlinking Nginx config file for HTTPS"
ln -s /defaults/nginx/https.conf /etc/nginx/http.d/pterodactyl.conf
else
log "HTTPS Nginx config is already in place"
fi
else
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
log "Symlinking Nginx config file for HTTP"
ln -s /defaults/nginx/http.conf /etc/nginx/http.d/pterodactyl.conf
else
log "HTTP Nginx config file is already in place"
fi
fi
# Setting permissions for /config
log "Making sure permission for config folder are correct"
chown -R nginx:nginx /config
log "Initialization complete"