mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 07:03:57 +00:00
build: install latest gosu from published image (#3717)
This commit is contained in:
@@ -15,6 +15,7 @@ ARG FORCE_INSTALL_PACKAGES=1
|
|||||||
RUN --mount=target=/build,source=build \
|
RUN --mount=target=/build,source=build \
|
||||||
TARGET=${TARGETARCH}${TARGETVARIANT} \
|
TARGET=${TARGETARCH}${TARGETVARIANT} \
|
||||||
/build/run.sh install-packages
|
/build/run.sh install-packages
|
||||||
|
COPY --from=tianon/gosu /gosu /usr/local/bin/
|
||||||
|
|
||||||
RUN --mount=target=/build,source=build \
|
RUN --mount=target=/build,source=build \
|
||||||
/build/run.sh setup-user
|
/build/run.sh setup-user
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ apk add --no-cache -U \
|
|||||||
imagemagick \
|
imagemagick \
|
||||||
file \
|
file \
|
||||||
lsof \
|
lsof \
|
||||||
su-exec \
|
|
||||||
coreutils \
|
coreutils \
|
||||||
findutils \
|
findutils \
|
||||||
procps \
|
procps \
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
GOSU_VERSION="1.16"
|
|
||||||
GOSU_BASE_URL="https://github.com/tianon/gosu/releases/download/$GOSU_VERSION"
|
|
||||||
|
|
||||||
case $(uname -m) in
|
|
||||||
"aarch64")
|
|
||||||
GOSU_ARCH="gosu-arm64"
|
|
||||||
;;
|
|
||||||
"x86_64")
|
|
||||||
GOSU_ARCH="gosu-amd64"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Architecture not supported!"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
curl -sL -o /bin/gosu "${GOSU_BASE_URL}/${GOSU_ARCH}"
|
|
||||||
chmod +x /bin/gosu
|
|
||||||
@@ -59,9 +59,6 @@ dnf install -y git-lfs
|
|||||||
# Clean up DNF when done
|
# Clean up DNF when done
|
||||||
dnf clean all
|
dnf clean all
|
||||||
|
|
||||||
# Install gosu (assuming the script /build/ol/install-gosu.sh exists and is executable)
|
|
||||||
bash /build/ol/install-gosu.sh
|
|
||||||
|
|
||||||
# Download and install patched knockd
|
# Download and install patched knockd
|
||||||
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
|
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
|
||||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ DEBIAN_FRONTEND=noninteractive \
|
|||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
file \
|
file \
|
||||||
gosu \
|
|
||||||
sudo \
|
sudo \
|
||||||
net-tools \
|
net-tools \
|
||||||
iputils-ping \
|
iputils-ping \
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then
|
|||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $(getSudoFromDistro) ${runAsUser}:${runAsGroup} "$(dirname "$0")/start-configuration" "$@"
|
exec gosu ${runAsUser}:${runAsGroup} "$(dirname "$0")/start-configuration" "$@"
|
||||||
else
|
else
|
||||||
exec "$(dirname "$0")/start-configuration" "$@"
|
exec "$(dirname "$0")/start-configuration" "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -121,17 +121,6 @@ function log() {
|
|||||||
eval "$oldState"
|
eval "$oldState"
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSudoFromDistro(){
|
|
||||||
distro=$(getDistro)
|
|
||||||
command=
|
|
||||||
if [[ $distro == alpine ]]; then
|
|
||||||
command="su-exec"
|
|
||||||
else
|
|
||||||
command="gosu"
|
|
||||||
fi
|
|
||||||
echo $command
|
|
||||||
}
|
|
||||||
|
|
||||||
# Refer to https://unix.stackexchange.com/a/10065/102376
|
# Refer to https://unix.stackexchange.com/a/10065/102376
|
||||||
function isTerminal() {
|
function isTerminal() {
|
||||||
if test -t 1; then
|
if test -t 1; then
|
||||||
|
|||||||
Reference in New Issue
Block a user