]> git.r.bdr.sh - rbdr/junction/commitdiff
Add docker files
authorRuben Beltran del Rio <redacted>
Wed, 7 Oct 2020 20:57:58 +0000 (22:57 +0200)
committerRuben Beltran del Rio <redacted>
Wed, 7 Oct 2020 20:57:58 +0000 (22:57 +0200)
server/Dockerfile [new file with mode: 0644]
server/Makefile [new file with mode: 0644]
server/docker-compose.yml [new file with mode: 0644]

diff --git a/server/Dockerfile b/server/Dockerfile
new file mode 100644 (file)
index 0000000..c22b56c
--- /dev/null
@@ -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 (file)
index 0000000..153bf67
--- /dev/null
@@ -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 (file)
index 0000000..3840196
--- /dev/null
@@ -0,0 +1,8 @@
+version: '2'
+
+services:
+  junction:
+    build: .
+    env_file: .env
+    ports:
+      - "8000:8000"