Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker image setup #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
17 changes: 17 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -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