commit a7d78e8b19f3f59a9abd7c21462fe9c0d5a6d416 Author: alexveley Date: Sat Apr 25 00:39:42 2026 -0400 Add Avorion Pterodactyl compatibility image diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..421aa33 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,42 @@ +name: Build and Publish Docker Image + +on: + push: + branches: [ "main" ] + tags: [ "v*" ] + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/avorion-steamcmd-nsswrap + tags: | + type=raw,value=latest + type=ref,event=tag + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4e8d501 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM ghcr.io/ptero-eggs/steamcmd:debian + +RUN apt-get update \ + && apt-get install -y --no-install-recommends libnss-wrapper \ + && rm -rf /var/lib/apt/lists/* + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +WORKDIR /home/container +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6feea8d --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# Avorion Pterodactyl Compatibility Image + +This is a thin wrapper image for the Avorion egg that keeps behavior as close as possible to the original `ghcr.io/ptero-eggs/steamcmd:debian` image while fixing Avorion's `getpwuid(getuid()) returned NULL` startup failure. + +## What this fixes + +Avorion expects the current runtime UID inside the container to resolve to a valid user entry with a home directory. On some Pterodactyl setups, the server process runs as a UID that does not exist in `/etc/passwd` inside the image. When that happens, Avorion can crash on startup with: + +- `Error finding home directory: getpwuid(getuid()) returned NULL` +- `Could not find a suitable directory for saving files` + +This image adds a temporary passwd/group entry at startup using `libnss-wrapper`, while keeping the rest of the egg behavior nearly unchanged. + +## Build and publish + +Replace `YOUR_GHCR_USER` with your GitHub Container Registry namespace. + +```bash +docker build -t ghcr.io/YOUR_GHCR_USER/avorion-steamcmd-nsswrap:latest . +docker push ghcr.io/YOUR_GHCR_USER/avorion-steamcmd-nsswrap:latest +``` + +## Egg changes + +In your Avorion egg JSON, change only the Docker image entry. + +From: + +```json +"docker_images": { + "ghcr.io/ptero-eggs/steamcmd:debian": "ghcr.io/ptero-eggs/steamcmd:debian" +} +``` + +To something like: + +```json +"docker_images": { + "ghcr.io/YOUR_GHCR_USER/avorion-steamcmd-nsswrap:latest": "ghcr.io/YOUR_GHCR_USER/avorion-steamcmd-nsswrap:latest" +} +``` + +You can leave the install script alone for the first test. + +## Recommended startup command + +Start with the most conservative startup possible so you are only testing the image fix: + +```bash +export HOME=/home/container; mkdir -p "/home/container/galaxy/{{GALAXY_NAME}}/moddata/ConfigLib"; exec ./bin/AvorionServer --galaxy-name "{{GALAXY_NAME}}" --admin "{{ADMIN_ID}}" --datapath galaxy --port "{{SERVER_PORT}}" --query-port "{{QUERY_PORT}}" --steam-master-port "{{STEAM_MASTER_PORT}}" --steam-query-port "{{STEAM_QUERY_PORT}}" --max-players "{{MAX_PLAYERS}}" --difficulty "{{DIFFICULTY}}" --collision-damage "{{COLLISION_DMG}}" --save-interval "{{SAVE_INTERVAL}}" --same-start-sector "{{SAME_START_SECTOR}}" --server-name "{{SERVER_NAME}}" --threads "{{GAME_THREADS}}" --listed "{{SERVER_LISTED}}" +``` + +## Suggested rollout steps + +1. Add `Dockerfile` and `entrypoint.sh` to a new Git repo. +2. Build and push the image to GHCR. +3. Update only the egg's Docker image reference. +4. Leave the install script unchanged. +5. Use the conservative startup command above. +6. Reinstall or rebuild the server container if needed so it pulls the new image. +7. Start the server and confirm the Avorion home-directory error is gone. +8. Only after it boots cleanly, revisit `--datapath`, symlinks, or mod path adjustments. \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..21f99e1 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -euo pipefail + +export USER=container +export HOME=/home/container +mkdir -p /home/container /tmp + +uid="$(id -u)" +gid="$(id -g)" + +PASSWD_FILE="/tmp/passwd" +GROUP_FILE="/tmp/group" + +cp /etc/passwd "$PASSWD_FILE" +cp /etc/group "$GROUP_FILE" + +if ! getent passwd "$uid" >/dev/null 2>&1; then + echo "container:x:${uid}:${gid}::/home/container:/bin/bash" >> "$PASSWD_FILE" +fi + +if ! getent group "$gid" >/dev/null 2>&1; then + echo "container:x:${gid}:" >> "$GROUP_FILE" +fi + +export NSS_WRAPPER_PASSWD="$PASSWD_FILE" +export NSS_WRAPPER_GROUP="$GROUP_FILE" + +libnss="$(find /usr/lib /lib -name 'libnss_wrapper.so' 2>/dev/null | head -n 1 || true)" +if [ -n "$libnss" ]; then + export LD_PRELOAD="${libnss}${LD_PRELOAD:+:${LD_PRELOAD}}" +fi + +cd /home/container + +if [ -n "${STARTUP:-}" ]; then + echo ":/home/container$ ${STARTUP}" + exec /bin/bash -c "${STARTUP}" +fi + +exec "$@" \ No newline at end of file