From 4c8eeb2e6f2741dd54a3c875158c75ac188a012f Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 10 Jun 2018 15:06:52 -0400 Subject: [PATCH] added docker build, closes #106 --- .dockerignore | 4 ++++ Dockerfile | 21 +++++++++++++++++++++ bin/build-docker.sh | 8 ++++++++ bin/push-docker-image.sh | 9 +++++++++ bin/release.sh | 4 ++++ 5 files changed, 46 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 bin/build-docker.sh create mode 100644 bin/push-docker-image.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..89938ab06 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +npm-debug.log +dist +.idea \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..9b40d32a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:8.11.2 + +RUN apt-get update && apt-get install -y nasm + +# Create app directory +WORKDIR /usr/src/app + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +# where available (npm@5+) +COPY package*.json ./ + +RUN npm install --production +# If you are building your code for production +# RUN npm install --only=production + +# Bundle app source +COPY . . + +EXPOSE 8080 +CMD [ "node", "src/www" ] diff --git a/bin/build-docker.sh b/bin/build-docker.sh new file mode 100755 index 000000000..072286b29 --- /dev/null +++ b/bin/build-docker.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [[ $# -eq 0 ]] ; then + echo "Missing argument of new version" + exit 1 +fi + +docker build -t zadam/trilium:latest -t zadam/trilium:$1 . \ No newline at end of file diff --git a/bin/push-docker-image.sh b/bin/push-docker-image.sh new file mode 100644 index 000000000..d8bf4d593 --- /dev/null +++ b/bin/push-docker-image.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [[ $# -eq 0 ]] ; then + echo "Missing argument of new version" + exit 1 +fi + +docker push zadam/trilium:latest +docker push zadam/trilium:$1 \ No newline at end of file diff --git a/bin/release.sh b/bin/release.sh index 0967443ea..a50ba2a6b 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -75,4 +75,8 @@ github-release upload \ --name "$WINDOWS_X64_BUILD" \ --file "dist/$WINDOWS_X64_BUILD" +bin/build-docker.sh $VERSION + +bin/push-docker-image.sh $VERSION + echo "Release finished!" \ No newline at end of file