commit 9ffd5c63d3c74e40bf6dfc6b9cf8f4ff92eed8b0 Author: Torsten Raudssus Date: Sun Mar 19 05:40:11 2023 +0100 First commit of the node docker image after move out of core diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5a76776 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +SciTEDirectory.properties +*/SciTEDirectory.properties +*~ +*.sql +*.sql.gz +*.zip +*.log +*.dmp +nytprof* +sublime_* +*.sublime-* +~* +*~ +*_ +_* +*/.DS_Store +.DS_Store +table_meta* +*# +/*.db +/*.xls +/*.xlsx +/*.csv +/*.pdf + +.gitignore + +node_modules +local +tmp +.parcel-cache + +.env +.mc +docker-compose.override.yml +.git + +root diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d0d34d --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +SciTEDirectory.properties +*/SciTEDirectory.properties +*~ +*.sql +*.sql.gz +*.zip +*.log +*.dmp +nytprof* +sublime_* +*.sublime-* +~* +*~ +*_ +_* +*/.DS_Store +.DS_Store +table_meta* +*# +/*.db +/*.xls +/*.xlsx +/*.csv +/*.pdf + +node_modules +local +tmp +.parcel-cache + +.env +.mc +docker-compose.override.yml +.git + +root +dist \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aa609b3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:18-bullseye + +ARG SRV_UID="1000" +ARG SRV_GID="100" +ARG SRV_VERSION="0" + +ENV SRV_UID $SRV_UID +ENV SRV_GID $SRV_GID +ENV SRV_VERSION $SRV_VERSION + +RUN apt-get update -y && apt-get install -y jq \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN id $SRV_UID || useradd -s /bin/bash -d /app -u $SRV_UID -g $SRV_GID srv + +COPY ./docker-entrypoint.sh /docker-entrypoint.sh + +USER $SRV_UID:$SRV_GID + +ENV PATH "/app/node_modules/.bin:$PATH" + +VOLUME /app + +WORKDIR /app + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..b27ca7a --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +IP=$( hostname -i ) + +if [[ -z "$@" ]] +then + if [[ -f "package.json" ]] + then + PACKAGE_JSON_START=$( cat package.json | jq -r '.scripts.start // empty' ) + if [[ -z "$PACKAGE_JSON_START" ]] + then + echo "package.json found, but no start script, starting bash..." + exec bash + else + exec $PACKAGE_JSON_START + fi + else + echo "No package.json found, starting bash..." + exec bash + fi +else + exec $@ +fi