From: Ruben Beltran del Rio Date: Wed, 7 Oct 2020 20:57:58 +0000 (+0200) Subject: Add docker files X-Git-Url: https://git.r.bdr.sh/rbdr/junction/commitdiff_plain/43c5f0ddbc5ab13568084c594f3175204617a8aa?ds=sidebyside;hp=c134086d29a5adaa45234de2f05512588dee26d9 Add docker files --- diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..c22b56c --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,10 @@ +FROM node:lts-slim + +WORKDIR /app + +COPY package-lock.json /app/ +COPY package.json /app/ +RUN npm install +COPY . /app + +ENTRYPOINT [ "node", "index.js" ]) diff --git a/server/Makefile b/server/Makefile new file mode 100644 index 0000000..153bf67 --- /dev/null +++ b/server/Makefile @@ -0,0 +1,31 @@ +# Never directly modify the default environment +environment = development + +repo_full_name = $(shell git remote -v | grep origin | grep push | grep -o '[^:/]\+\/[^/]\+\s\+' | grep -o '[^:]\+\/[^. ]\+') +git_sha = $(shell git rev-parse --short HEAD) + +default: build + +build: docker-build + +run: build + docker-compose up + +package: build + +upload: build + docker push $(repo_full_name) + +clean: clean-docker-build + +test_ci: + docker-compose --project-name ci_build -f test/docker-compose-ci.yml run junction + +docker-build: + docker build --force-rm -t $(repo_full_name):$(git_sha) . + docker tag $(repo_full_name):$(git_sha) $(repo_full_name):latest + +# Dashes before the commands below indicate a non-zero exit status is okay. +clean-docker-build: + -docker rm $(repo_full_name):$(git_sha) + -docker rmi $(repo_full_name):$(git_sha) diff --git a/server/docker-compose.yml b/server/docker-compose.yml new file mode 100644 index 0000000..3840196 --- /dev/null +++ b/server/docker-compose.yml @@ -0,0 +1,8 @@ +version: '2' + +services: + junction: + build: . + env_file: .env + ports: + - "8000:8000"