From ece0f3c9bb5ac3630bf90aadc8c93862b6480865 Mon Sep 17 00:00:00 2001 From: "andrew.greene" Date: Mon, 17 Jan 2022 09:31:18 -0700 Subject: [PATCH] Add podman support --- Dockerfile => Containerfile | 3 +++ container-build.sh | 13 +++++++++++++ container-run.sh | 11 +++++++++++ docker-build.sh | 6 ------ docker-run.sh | 4 ---- 5 files changed, 27 insertions(+), 10 deletions(-) rename Dockerfile => Containerfile (91%) create mode 100755 container-build.sh create mode 100755 container-run.sh delete mode 100755 docker-build.sh delete mode 100755 docker-run.sh diff --git a/Dockerfile b/Containerfile similarity index 91% rename from Dockerfile rename to Containerfile index ec5ab1b1f..3627d9af6 100644 --- a/Dockerfile +++ b/Containerfile @@ -10,6 +10,9 @@ RUN npm run build FROM node:stretch-slim +RUN useradd -ms /bin/bash appuser +USER appuser + WORKDIR /app COPY --from=builder --chown=appuser:appuser /home/node/node_modules node_modules diff --git a/container-build.sh b/container-build.sh new file mode 100755 index 000000000..cb65c6b31 --- /dev/null +++ b/container-build.sh @@ -0,0 +1,13 @@ +VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4) + +CONTAINER_ENGINE=$1 +if [ -z $CONTAINER_ENGINE ]; then + CONTAINER_ENGINE=docker +fi + +echo using $CONTAINER_ENGINE container engine... + +$CONTAINER_ENGINE build --rm --no-cache \ + --build-arg BUILD_DATE="$(date +"%Y-%m-%dT%H:%M:%SZ")" \ + --file Containerfile \ + --tag sparkle-guide:$VERSION . \ No newline at end of file diff --git a/container-run.sh b/container-run.sh new file mode 100755 index 000000000..dee2ad5df --- /dev/null +++ b/container-run.sh @@ -0,0 +1,11 @@ +#!/bin/bash +VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4) + +CONTAINER_ENGINE=$1 +if [ -z $CONTAINER_ENGINE ]; then + CONTAINER_ENGINE=docker +fi + +echo using $CONTAINER_ENGINE container engine... + +$CONTAINER_ENGINE run -p 1880:1880 -v "$(pwd)"/data/:/root/.node-red/ sparkle-guide:$VERSION & \ No newline at end of file diff --git a/docker-build.sh b/docker-build.sh deleted file mode 100755 index 9cc89f9e5..000000000 --- a/docker-build.sh +++ /dev/null @@ -1,6 +0,0 @@ -VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4) - -docker build --rm --no-cache \ - --build-arg BUILD_DATE="$(date +"%Y-%m-%dT%H:%M:%SZ")" \ - --file Dockerfile \ - --tag sparkle-guide:$VERSION . \ No newline at end of file diff --git a/docker-run.sh b/docker-run.sh deleted file mode 100755 index 61f955cc7..000000000 --- a/docker-run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4) - -docker run -p 1880:1880 -v "$(pwd)"/data/:/root/.node-red/ sparkle-guide:$VERSION & \ No newline at end of file