| |
| FROM ubuntu:22.04 |
|
|
| ENV DEBIAN_FRONTEND=noninteractive |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| curl wget unzip tar supervisor cron \ |
| mariadb-server redis-server nginx \ |
| php-cli php-fpm php-mysql php-mbstring \ |
| php-bcmath php-xml php-curl php-zip php-gd \ |
| && apt-get clean \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
|
|
| WORKDIR /var/www/pterodactyl |
|
|
| |
| RUN curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz \ |
| && tar -xzvf panel.tar.gz \ |
| && chmod -R 755 storage/* bootstrap/cache/ \ |
| && cp .env.example .env |
|
|
| |
| RUN service mariadb start \ |
| && sleep 5 \ |
| && mysql -e "CREATE DATABASE panel;" \ |
| && mysql -e "CREATE USER 'pterodactyl'@'127.0.0.1' IDENTIFIED BY 'password';" \ |
| && mysql -e "GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'127.0.0.1' WITH GRANT OPTION;" \ |
| && mysql -e "FLUSH PRIVILEGES;" \ |
| && composer install --no-dev --optimize-autoloader \ |
| && php artisan key:generate --force \ |
| && sed -i 's/DB_PASSWORD=/DB_PASSWORD=password/g' .env \ |
| && sed -i 's/APP_URL=http:\/\/localhost/APP_URL=http:\/\/localhost:7860/g' .env \ |
| && sed -i 's/CACHE_DRIVER=file/CACHE_DRIVER=redis/g' .env \ |
| && sed -i 's/SESSION_DRIVER=file/SESSION_DRIVER=redis/g' .env \ |
| && sed -i 's/QUEUE_CONNECTION=sync/QUEUE_CONNECTION=redis/g' .env \ |
| && php artisan migrate --seed --force \ |
| && php artisan p:user:make --email="admin@example.com" --username="admin" --name-first="Admin" --name-last="User" --password="admin" --admin=1 \ |
| && chown -R www-data:www-data /var/www/pterodactyl/* |
|
|
| |
| |
| RUN rm /etc/nginx/sites-enabled/default |
| COPY <<"EOF" /etc/nginx/sites-enabled/pterodactyl.conf |
| server { |
| listen 7860; |
| server_name _; |
| root /var/www/pterodactyl/public; |
| index index.html index.htm index.php; |
| charset utf-8; |
|
|
| location / { |
| try_files $uri $uri/ /index.php?$query_string; |
| } |
|
|
| location = /favicon.ico { access_log off; log_not_found off; } |
| location = /robots.txt { access_log off; log_not_found off; } |
|
|
| access_log off; |
| error_log /var/log/nginx/pterodactyl.app-error.log error; |
|
|
| client_max_body_size 100m; |
| client_body_timeout 120s; |
|
|
| sendfile off; |
|
|
| location ~ \.php$ { |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| fastcgi_pass unix:/run/php/php8.1-fpm.sock; |
| fastcgi_index index.php; |
| include fastcgi_params; |
| fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| fastcgi_param HTTP_PROXY ""; |
| fastcgi_intercept_errors off; |
| fastcgi_buffer_size 16k; |
| fastcgi_buffers 4 16k; |
| fastcgi_connect_timeout 300; |
| fastcgi_send_timeout 300; |
| fastcgi_read_timeout 300; |
| } |
|
|
| location ~ /\.ht { |
| deny all; |
| } |
| } |
| EOF |
|
|
| |
| COPY <<"EOF" /etc/supervisor/conf.d/supervisord.conf |
| [supervisord] |
| nodaemon=true |
| user=root |
|
|
| [program:mysql] |
| command=/usr/bin/mysqld_safe |
| autostart=true |
| autorestart=true |
|
|
| [program:redis] |
| command=/usr/bin/redis-server |
| autostart=true |
| autorestart=true |
|
|
| [program:php-fpm] |
| command=/usr/sbin/php-fpm8.1 -F |
| autostart=true |
| autorestart=true |
|
|
| [program:nginx] |
| command=/usr/sbin/nginx -g "daemon off;" |
| autostart=true |
| autorestart=true |
|
|
| [program:pteroq] |
| command=php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 |
| autostart=true |
| autorestart=true |
| user=www-data |
| EOF |
|
|
| |
| RUN mkdir -p /run/php && chown -R www-data:www-data /run/php |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
|
|