Skip to content

Commit

Permalink
Merge pull request #1 from UniversityOfHelsinkiCS/trunk
Browse files Browse the repository at this point in the history
Mvp, Travis, confs
  • Loading branch information
totutotu authored Apr 3, 2019
2 parents e47b245 + 5de618b commit 3a4a154
Show file tree
Hide file tree
Showing 15 changed files with 3,700 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.vscode
.env
debug.log
npm-debug.log
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sudo: required
cache:
npm: true
directories:
- node_modules
- ~/.cache

services:
- docker

jobs:
include:
- stage: build & deploy
script:
- "if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker build --build-arg BASE_PATH=/staging/ -t toska/oodikone2-usageservice:staging . ; else :;fi"
- "if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker login -u $DOCKER_USER -p $DOCKER_PASS ; else :;fi"
- "if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker push toska/oodikone2-usageservice:staging ; else :;fi"
- "if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker build --build-arg BASE_PATH=/ -t toska/oodikone2-usageservice:latest . ; else :;fi"
- "if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker login -u $DOCKER_USER -p $DOCKER_PASS ; else :;fi"
- "if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker push toska/oodikone2-usageservice:latest ; else :;fi"
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:10-alpine

RUN mkdir -p /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app

RUN npm install
EXPOSE 545

CMD ["npm", "start"]
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const express = require('express')
const conf = require('./src/conf-usageservice')
const { PORT } = conf
const router = require('./src/routes')
const app = express()

app.use(router)

module.exports = app.listen(PORT, () => {
console.log('Example app listening on port ' + PORT + '!')
})
Loading

0 comments on commit 3a4a154

Please sign in to comment.