entrypoint.sh in sequence. The exact steps depend on whether this is a first start, whether GIT_URL is set, and whether AUTO_UPDATE is enabled.
First start (empty container, GIT_URL set)
When the container has nopackage.json and GIT_URL is configured, the egg clones your repository from scratch before doing anything else.
1
Clone the repository
Because no If
package.json exists, the egg clears the container directory and clones your repository:GIT_BRANCH is empty, git uses the repository’s default branch. If USERNAME and ACCESS_TOKEN are set, the egg injects them into the URL automatically — you never need to embed credentials in GIT_URL yourself.2
Copy .env file (if present)
If This is how you inject environment variables without exposing them in panel variables. Upload
.env.pterodactyl exists in /home/container, the egg copies it to .env:.env.pterodactyl via the File Manager before starting.3
Detect or use the configured package manager
The egg reads the
PACKAGE_MANAGER variable (default: auto). In auto mode it inspects your project for a lockfile:If you set
PACKAGE_MANAGER explicitly to npm, pnpm, or yarn, that value is used regardless of which lockfiles are present.If pnpm or yarn is not already installed in the container, the egg installs it globally via npm before continuing.4
Install dependencies
Dependencies are installed using the detected or configured package manager:
5
Build the application (production only)
If
NODE_RUN_ENV=production, the egg builds your app before starting it:This step is skipped entirely when
NODE_RUN_ENV=development.6
Start Cloudflare Tunnel (if configured)
If If
CLOUDFLARE_TOKEN is set, the egg downloads cloudflared (if not already present) and starts the tunnel in the background before launching Next.js:CLOUDFLARE_TOKEN is empty, this step is skipped.7
Start Next.js
The egg starts Next.js in the foreground using the port assigned by the panel:The panel considers the server online once it detects one of these strings in stdout:
ready on, started server on, Local: http://, Compiled successfully, listening on, or ▲ Next.js.The egg runs
npm run build (or the equivalent pnpm/yarn command) on every start in production mode. This ensures your app always reflects the latest code.Subsequent starts with AUTO_UPDATE=1
WhenAUTO_UPDATE=1 and a .git directory is present, the egg pulls the latest commits before reinstalling and rebuilding.
1
Pull latest changes
The egg resets any local changes and pulls from the remote:If
GIT_BRANCH is empty, the egg runs git pull against the current tracking branch.2
Copy .env file (if present)
Same as first start — if
.env.pterodactyl exists, it is copied to .env.3
Detect package manager
Same lockfile detection logic as on first start.
4
Install dependencies
Same install commands as on first start. Running this on every restart ensures any newly added packages from the latest commit are present.
5
Build the application (production only)
Same build step as on first start —
next build runs every time in production mode.6
Start Cloudflare Tunnel (if configured)
Same as first start — starts
cloudflared in the background if CLOUDFLARE_TOKEN is set.7
Start Next.js
Same as first start —
next start -p $SERVER_PORT or next dev -p $SERVER_PORT.Subsequent starts with AUTO_UPDATE=0
WhenAUTO_UPDATE=0, the egg skips all git operations and uses whatever code is already in the container.
1
Skip git pull
The egg detects that
AUTO_UPDATE is not 1 and logs AUTO_UPDATE disabled — skipping pull. No git commands are run. The code currently on disk is used as-is.2
Copy .env file (if present)
If
.env.pterodactyl exists, it is still copied to .env on every start regardless of the AUTO_UPDATE setting.3
Detect package manager
Same lockfile detection logic as on first start.
4
Install dependencies
Dependencies are still installed on every restart to account for any manual changes to
package.json.5
Build the application (production only)
The build still runs on every restart in production mode, even without a git pull.
6
Start Cloudflare Tunnel (if configured)
Same as first start — starts
cloudflared in the background if CLOUDFLARE_TOKEN is set.7
Start Next.js
Same as first start —
next start -p $SERVER_PORT or next dev -p $SERVER_PORT.GIT_URL is empty
If you leaveGIT_URL blank, the egg skips all git operations entirely and expects you to have uploaded your project files manually.
- All git steps (clone, fetch, pull) are skipped.
- The egg checks whether
/home/container/package.jsonexists. If it does not, the egg exits immediately with an error:You must upload your project files — includingpackage.json— via the panel’s File Manager before restarting. - If
package.jsonis found, the egg continues with the.envcopy, dependency install, build (if production), and Next.js start steps as normal.