-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docker nodejs permission in MacOS
Signed-off-by: Son Bui <[email protected]>
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ARG NODE_VERSION=20 | ||
ARG FIXUID_VERSION=0.6.0 | ||
|
||
FROM node:${NODE_VERSION}-alpine | ||
|
||
ARG FIXUID_VERSION | ||
|
||
RUN apk --no-cache add curl | ||
|
||
COPY docker-entrypoint /usr/local/bin/ | ||
|
||
RUN USER=node && \ | ||
GROUP=node && \ | ||
if [[ "$(uname -m)" = "aarch64" ]] ; \ | ||
then \ | ||
curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-arm64.tar.gz | tar -C /usr/local/bin -xzf - ;\ | ||
else \ | ||
curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - ;\ | ||
fi; \ | ||
chown root:root /usr/local/bin/fixuid && \ | ||
chmod 4755 /usr/local/bin/fixuid && \ | ||
mkdir -p /etc/fixuid && \ | ||
printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml | ||
|
||
USER node:node | ||
|
||
ENTRYPOINT ["docker-entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
eval $( fixuid ) | ||
|
||
if [ $# -eq 1 ]; then | ||
# Use a subshell to execute the potentially multiline command | ||
exec /bin/sh -c "$1" | ||
else | ||
exec "$@" | ||
fi |