Skip to content

Commit 66f26c0

Browse files
authored
build: install latest gosu from published image (#3717)
1 parent 998b61d commit 66f26c0

File tree

7 files changed

+2
-39
lines changed

7 files changed

+2
-39
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ARG FORCE_INSTALL_PACKAGES=1
1515
RUN --mount=target=/build,source=build \
1616
TARGET=${TARGETARCH}${TARGETVARIANT} \
1717
/build/run.sh install-packages
18+
COPY --from=tianon/gosu /gosu /usr/local/bin/
1819

1920
RUN --mount=target=/build,source=build \
2021
/build/run.sh setup-user

build/alpine/install-packages.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ apk add --no-cache -U \
1010
imagemagick \
1111
file \
1212
lsof \
13-
su-exec \
1413
coreutils \
1514
findutils \
1615
procps \

build/ol/install-gosu.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

build/ol/install-packages.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ dnf install -y git-lfs
5959
# Clean up DNF when done
6060
dnf clean all
6161

62-
# Install gosu (assuming the script /build/ol/install-gosu.sh exists and is executable)
63-
bash /build/ol/install-gosu.sh
64-
6562
# Download and install patched knockd
6663
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
6764
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz

build/ubuntu/install-packages.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ DEBIAN_FRONTEND=noninteractive \
1111
apt-get install -y \
1212
imagemagick \
1313
file \
14-
gosu \
1514
sudo \
1615
net-tools \
1716
iputils-ping \

scripts/start

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then
4848
echo 'hosts: files dns' > /etc/nsswitch.conf
4949
fi
5050

51-
exec $(getSudoFromDistro) ${runAsUser}:${runAsGroup} "$(dirname "$0")/start-configuration" "$@"
51+
exec gosu ${runAsUser}:${runAsGroup} "$(dirname "$0")/start-configuration" "$@"
5252
else
5353
exec "$(dirname "$0")/start-configuration" "$@"
5454
fi

scripts/start-utils

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ function log() {
121121
eval "$oldState"
122122
}
123123

124-
function getSudoFromDistro(){
125-
distro=$(getDistro)
126-
command=
127-
if [[ $distro == alpine ]]; then
128-
command="su-exec"
129-
else
130-
command="gosu"
131-
fi
132-
echo $command
133-
}
134-
135124
# Refer to https://unix.stackexchange.com/a/10065/102376
136125
function isTerminal() {
137126
if test -t 1; then

0 commit comments

Comments
 (0)