Add node images
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
FROM node:25-alpine3.22
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
COPY ./entrypoint.sh .
|
||||||
|
|
||||||
|
RUN chmod +x /root/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/root/entrypoint.sh" ]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT="$1"
|
||||||
|
WORKDIR="$2"
|
||||||
|
|
||||||
|
echo "
|
||||||
|
Setting workdir from current dir, which is $(pwd)
|
||||||
|
"
|
||||||
|
if [ -n "$WORKDIR" ]; then
|
||||||
|
cd "$WORKDIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
Running node script
|
||||||
|
"
|
||||||
|
|
||||||
|
node $SCRIPT >/tmp/log.txt
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
cd base
|
||||||
|
./build-image.sh git.janishutz.com/registry/node-runner
|
||||||
|
cd ../npm
|
||||||
|
./build-image.sh git.janishutz.com/registry/npm-runner
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
FROM node:25-alpine3.22
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
COPY ./entrypoint.sh .
|
||||||
|
|
||||||
|
RUN chmod +x /root/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/root/entrypoint.sh" ]
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Build will be tagged with $1"
|
||||||
|
echo "Build directory is $(pwd)"
|
||||||
|
|
||||||
|
OLD_IMG=$(docker image ls -q "$1")
|
||||||
|
docker buildx build . -t "$1"
|
||||||
|
|
||||||
|
echo "Build complete, starting upload..."
|
||||||
|
docker push "$1"
|
||||||
|
|
||||||
|
if [ -n "$OLD_IMG" ]; then
|
||||||
|
if [ "$OLD_IMG" != "$(docker image ls -q "$1")" ]; then
|
||||||
|
echo "New build uploaded, removing old image, id: $OLD_IMG"
|
||||||
|
docker image rmi -f "$OLD_IMG" || true
|
||||||
|
echo "Exit status: $?"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NPM_CMD="$1"
|
||||||
|
WORKDIR="$2"
|
||||||
|
FULL_PKG="$3"
|
||||||
|
|
||||||
|
if [ -n "$FULL_PKG" ]; then
|
||||||
|
if [ "$FULL_PKG" == "true" ]; then
|
||||||
|
npm i
|
||||||
|
else
|
||||||
|
npm i --omit=dev
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
npm i --omit=dev
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
Setting workdir from current dir, which is $(pwd)
|
||||||
|
"
|
||||||
|
if [ -n "$WORKDIR" ]; then
|
||||||
|
cd "$WORKDIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
Running npm command
|
||||||
|
"
|
||||||
|
|
||||||
|
npm run $NPM_CMD >/tmp/log.txt || compile_fail=1
|
||||||
|
|
||||||
|
if [ ${compile_fail:-0} -eq 1 ]; then
|
||||||
|
cat /tmp/log.txt
|
||||||
|
echo "
|
||||||
|
==> Compile has failed. See log above
|
||||||
|
"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Compile successful, log omitted"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user