From 0d0b072f1ca262340f89a43b6abac3678aae2f73 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 13 Dec 2023 15:40:25 +0100 Subject: [PATCH 1/2] fixing docker files --- docker/Dockerfile | 19 +++++++++++++++++++ docker/build.sh | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/build.sh diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..7c7b1b5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,19 @@ +FROM node:21-alpine + +RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app + +WORKDIR /home/node/app + +#COPY package*.json ./ + +COPY --chown=node:node . . + +USER node + +RUN npm install + +#COPY --chown=node:node . . + +EXPOSE 8080 + +CMD [ "node", "server.js" ] diff --git a/docker/build.sh b/docker/build.sh new file mode 100644 index 0000000..07943cb --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh +PUSH=$1 +DOCKER_REPO=karlsennetwork/karlsen-explorer + +set -e + +tag=$(git log -n1 --format="%cs.%h") + +cd $(dirname $(cd $(dirname $0); pwd)) +docker build --pull -t $DOCKER_REPO:$tag -f docker/Dockerfile . +docker tag $DOCKER_REPO:$tag $DOCKER_REPO:latest +echo Tagged $DOCKER_REPO:latest + +if [ "$PUSH" = "push" ]; then + docker push $DOCKER_REPO:$tag + docker push $DOCKER_REPO:latest +fi From 0e6059082c9738aac1e1d2155aedfe5e8e6a33c3 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 13 Dec 2023 16:12:57 +0100 Subject: [PATCH 2/2] remove CRLF --- docker/Dockerfile | 38 +++++++++++++++++++------------------- docker/build.sh | 34 +++++++++++++++++----------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7c7b1b5..63e4b88 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,19 +1,19 @@ -FROM node:21-alpine - -RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app - -WORKDIR /home/node/app - -#COPY package*.json ./ - -COPY --chown=node:node . . - -USER node - -RUN npm install - -#COPY --chown=node:node . . - -EXPOSE 8080 - -CMD [ "node", "server.js" ] +FROM node:21-alpine + +RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app + +WORKDIR /home/node/app + +#COPY package*.json ./ + +COPY --chown=node:node . . + +USER node + +RUN npm install + +#COPY --chown=node:node . . + +EXPOSE 8080 + +CMD [ "node", "server.js" ] diff --git a/docker/build.sh b/docker/build.sh index 07943cb..4cbdd02 100644 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,17 +1,17 @@ -#!/bin/sh -PUSH=$1 -DOCKER_REPO=karlsennetwork/karlsen-explorer - -set -e - -tag=$(git log -n1 --format="%cs.%h") - -cd $(dirname $(cd $(dirname $0); pwd)) -docker build --pull -t $DOCKER_REPO:$tag -f docker/Dockerfile . -docker tag $DOCKER_REPO:$tag $DOCKER_REPO:latest -echo Tagged $DOCKER_REPO:latest - -if [ "$PUSH" = "push" ]; then - docker push $DOCKER_REPO:$tag - docker push $DOCKER_REPO:latest -fi +#!/bin/sh +PUSH=$1 +DOCKER_REPO=karlsennetwork/karlsen-explorer + +set -e + +tag=$(git log -n1 --format="%cs.%h") + +cd $(dirname $(cd $(dirname $0); pwd)) +docker build --pull -t $DOCKER_REPO:$tag -f docker/Dockerfile . +docker tag $DOCKER_REPO:$tag $DOCKER_REPO:latest +echo Tagged $DOCKER_REPO:latest + +if [ "$PUSH" = "push" ]; then + docker push $DOCKER_REPO:$tag + docker push $DOCKER_REPO:latest +fi