-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6490fc
commit 1ce513e
Showing
6 changed files
with
93 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM node:21-alpine | ||
|
||
ENV ASUSER= \ | ||
UID=0 \ | ||
ENTRYPOINT=entrypoint.node.sh | ||
|
||
WORKDIR /app | ||
|
||
RUN adduser -D -u 1337 kool && deluser --remove-home node \ | ||
# deps | ||
&& apk add --no-cache \ | ||
bash \ | ||
git \ | ||
shadow \ | ||
su-exec \ | ||
curl \ | ||
# build tools | ||
g++ \ | ||
libpng-dev \ | ||
make \ | ||
zlib-dev \ | ||
&& npm install -g pnpm \ | ||
&& rm -rf rm -rf /root/.npm/* \ | ||
# dockerize | ||
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-alpine-linux-amd64-v0.6.1.tar.gz | tar xz \ | ||
&& mv dockerize /usr/local/bin/dockerize | ||
|
||
COPY root-npmrc /root/.npmrc | ||
COPY --chown=kool:kool kool-npmrc /home/kool/.npmrc | ||
COPY entrypoint /entrypoint | ||
|
||
RUN chmod +x /entrypoint | ||
|
||
RUN mkdir -p /usr/local/lib/node_modules && chmod -R 777 /usr/local/lib/node_modules | ||
|
||
RUN npm i --location=global npm@latest | ||
|
||
ENTRYPOINT [ "/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,20 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Run as current user | ||
CURRENT_USER=${ASUSER:-${UID:-0}} | ||
|
||
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then | ||
usermod -u $CURRENT_USER kool | ||
fi | ||
|
||
# Run entrypoint if provided | ||
if [ ! -z "$ENTRYPOINT" ] && [ -f "$ENTRYPOINT" ]; then | ||
bash $ENTRYPOINT | ||
fi | ||
|
||
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then | ||
exec su-exec kool "$@" | ||
else | ||
exec "$@" | ||
fi |
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,4 @@ | ||
scripts-prepend-node-path=true | ||
package-import-method=copy | ||
shamefully-hoist=true | ||
store-dir=/home/kool/.pnpm-store |
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,4 @@ | ||
scripts-prepend-node-path=true | ||
package-import-method=copy | ||
shamefully-hoist=true | ||
store-dir=/root/.pnpm-store |
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