From c812d46287b58d418f45f077686f5107ce472f34 Mon Sep 17 00:00:00 2001 From: "Dowideit, Sven (O&A, St. Lucia)" Date: Fri, 20 Jul 2018 10:28:19 +1000 Subject: [PATCH] Add Docker suport Signed-off-by: Dowideit, Sven (O&A, St. Lucia) --- Dockerfile | 14 ++++++++++++++ Makefile | 10 ++++++++++ bin/control.sh | 7 +++++++ 3 files changed, 31 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..20f8d33f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:alpine + +RUN apk --no-cache add jq + +WORKDIR /opt/Cronicle + +COPY . /opt/Cronicle/ +RUN npm install +RUN node bin/build.js dist + +CMD ["/opt/Cronicle/bin/control.sh", "setup_and_start"] + +EXPOSE 3012 +VOLUME ["/opt/Cronicle/logs", "/opt/Cronicle/data"] diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..396d4d41 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ + +IMAGE=cronicle + +run: build + docker run --rm -it \ + -p 3012:3012 \ + $(IMAGE) + +build: + docker build -t $(IMAGE) . \ No newline at end of file diff --git a/bin/control.sh b/bin/control.sh index 13056fbb..dd306310 100755 --- a/bin/control.sh +++ b/bin/control.sh @@ -99,6 +99,13 @@ do node $HOMEDIR/bin/storage-cli.js setup exit ;; + setup_and_start) + # one entrypoint that initialises the filesystem only if needed. + if [ ! -e $HOMEDIR/data/_temp ]; then + $HOMEDIR/bin/control.sh setup + fi + exec $HOMEDIR/bin/debug.sh start + ;; maint) node $HOMEDIR/bin/storage-cli.js maint $2 exit