Add Avorion Pterodactyl compatibility image
Some checks failed
Build and Publish Docker Image / docker (push) Failing after 2m22s
Some checks failed
Build and Publish Docker Image / docker (push) Failing after 2m22s
This commit is contained in:
40
entrypoint.sh
Executable file
40
entrypoint.sh
Executable file
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user