summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael <raphaelkabo@gmail.com>2020-01-10 19:13:49 +1100
committerGitHub <noreply@github.com>2020-01-10 19:13:49 +1100
commit1df5f8cb731802df22fef8f22f9d70d3819a8008 (patch)
tree97e6b5f9e0cefb39472b91cd73728894ab8d3c63
parentc5835cbdbcfe3abda637e298a89b36ebb058c22a (diff)
parent452c9f42f3769035cdb73e143283eff814de544d (diff)
Merge pull request #31 from palfrey/docker-travis
Add Dockerised and Travis builds
-rw-r--r--.travis.yml8
-rw-r--r--Dockerfile7
-rw-r--r--README.md1
-rw-r--r--config/database-docker.js3
-rw-r--r--docker-compose.yml10
-rwxr-xr-xtest.sh15
6 files changed, 44 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..cdf8b48
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+language: shell
+os: linux
+
+services:
+ - docker
+
+script:
+ - ./test.sh \ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a436239
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,7 @@
+FROM node:13-alpine
+WORKDIR /app
+ADD package.json package-lock.json /app/
+RUN npm install
+COPY . /app/
+RUN cp config/api-example.js config/api.js && cp config/domain-example.js config/domain.js && cp config/database-docker.js config/database.js
+CMD npm start
diff --git a/README.md b/README.md
index eb2403f..0d33a84 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# gathio
+[![Build Status](https://travis-ci.com/palfrey/gathio.svg?branch=master)](https://travis-ci.com/palfrey/gathio)
Self-destructing, shareable, no-registration event pages.
diff --git a/config/database-docker.js b/config/database-docker.js
new file mode 100644
index 0000000..7847097
--- /dev/null
+++ b/config/database-docker.js
@@ -0,0 +1,3 @@
+module.exports = {
+ 'url' : 'mongodb://mongo:27017/gathio' // For dockerised MongoDB connection
+};
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..d16e279
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,10 @@
+version: '3'
+services:
+ gathio:
+ build: .
+ links:
+ - mongo
+ ports:
+ - 3000:3000
+ mongo:
+ image: mongo:latest \ No newline at end of file
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..6626437
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -eux -o pipefail
+
+cleanup() {
+ docker-compose kill
+}
+trap cleanup 0
+
+docker-compose up --build &
+
+while [[ "$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/)" -ne "200" ]]; do sleep 5; done
+curl -v http://localhost:3000/new/event/public
+
+cleanup \ No newline at end of file