Skip to content

Commit 51fb782

Browse files
committed
alpha: add wrapper for ok instead of running whole thing as non-root
1 parent 2a04cc0 commit 51fb782

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ dockers:
105105
- "--label=org.opencontainers.image.version={{.Version}}"
106106
- "--platform=linux/amd64"
107107
extra_files:
108-
- dockerfiles/entrypoint.sh
108+
- dockerfiles/wrapper.sh

dockerfiles/Dockerfile.alpine

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ RUN apk add --no-cache curl shadow && \
1616
curl -L https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64 -o /usr/local/lib/docker/cli-plugins/docker-buildx && \
1717
chmod a+x /usr/local/lib/docker/cli-plugins/docker-buildx
1818

19-
COPY dockerfiles/entrypoint.sh /root/entrypoint.sh
19+
COPY dockerfiles/wrapper.sh /usr/bin/ok
2020

2121
WORKDIR /app
2222
COPY ok /bin
23-
ENTRYPOINT ["/root/entrypoint.sh"]
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ PGID=${PGID:-1000}
66
groupmod -o -g "${PGID}" outblocks > /dev/null
77
usermod -o -u "${PUID}" outblocks > /dev/null
88

9-
if [ "${RUN_AS_ROOT:-0}" = "1" ]; then
10-
exec "$@"
11-
else
12-
exec gosu outblocks "$@"
9+
if [ "${RUN_AS_ROOT:-0}" = "1" ] || [ "$(id -u || true)" != "0" ]; then
10+
exec ok "$@"
11+
return
1312
fi
13+
14+
exec gosu outblocks /bin/ok "$@"

0 commit comments

Comments
 (0)