diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d94768..5b68739 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,11 +10,6 @@ jobs: - run: name: Build docker image command: docker build -t nfpis/caspar-sup:build_${CIRCLE_BUILD_NUM} -t nfpis/caspar-sup:${CIRCLE_SHA1} -t nfpis/caspar-sup:latest . - - run: - name: Run test and lint - command: | - docker run nfpis/recording_control npm run lint - docker run nfpis/recording_control npm run test - deploy: name: Push to docker command: | diff --git a/Dockerfile b/Dockerfile index 17d9c20..d6e6977 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,40 @@ -FROM node:slim +########################### +# Mithril +########################### +FROM node:8-alpine as build ENV HOME=/app COPY package.json $HOME/ +COPY app $HOME/app +COPY public $HOME/public WORKDIR $HOME -RUN npm install +RUN apk add --no-cache make gcc g++ python && \ + npm install && \ + npm run build -COPY . $HOME/ +########################### +# Server +########################### +FROM node:8-alpine -EXPOSE 4011 +ENV HOME=/app + +COPY .babelrc config.js log.js index.js package.json $HOME/ + +WORKDIR $HOME + +RUN apk add --no-cache make gcc g++ python && \ + npm install --production + +COPY api $HOME/api +COPY migrations $HOME/migrations +COPY config $HOME/config +COPY script $HOME/script +COPY --from=build /app/public $HOME/public + +EXPOSE 3000 CMD ["npm", "start"] diff --git a/package.json b/package.json index e9f49fa..0b4891e 100644 --- a/package.json +++ b/package.json @@ -44,32 +44,31 @@ }, "homepage": "https://github.com/nfp-projects/caspar-sup#readme", "dependencies": { - "app-root-path": "^2.0.1", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", "babel-register": "^6.26.0", - "bookshelf": "^0.11.1", + "bookshelf": "^0.13.3", "bunyan": "^1.8.12", - "casparcg-connection": "^4.1.0", - "dragula": "^3.7.2", + "casparcg-connection": "4.1.0", "ip": "^1.1.5", "knex": "^0.14.2", "koa": "^2.4.1", "koa-better-serve": "^2.0.7", "koa-socket": "^4.4.0", - "mithril": "^1.1.5", "nconf": "^0.9.1", "socket.io": "^2.0.4", - "socket.io-client": "^2.0.4", "sqlite3": "^3.1.13" }, "devDependencies": { "babelify": "^8.0.0", "browserify": "^16.2.2", + "dragula": "^3.7.2", "eslint": "^4.16.0", "eslint-plugin-mocha": "^4.11.0", + "mithril": "^1.1.5", "mocha": "^4.0.1", "nodemon": "^1.12.1", "npm-run-all": "^4.1.2", + "socket.io-client": "^2.0.4", "stylus": "^0.54.5", "watchify": "^3.9.0" } diff --git a/script/setup.js b/script/setup.js index 2e70ca0..508abc0 100644 --- a/script/setup.js +++ b/script/setup.js @@ -3,9 +3,8 @@ 'use strict' const _ = require('lodash') -const appRoot = require('app-root-path') -const config = require(appRoot.resolve('/config')) -let log = require(appRoot.resolve('/log')).default +const config = require('../config') +let log = require('../log').default // This is important for setup to run cleanly. let knexConfig = _.cloneDeep(config.get('knex')) @@ -17,7 +16,7 @@ log.info(knexConfig, 'Connected to database') let setup = module.exports = () => knex.migrate.latest({ - directory: appRoot.resolve('/migrations'), + directory: './migrations', }) .then((result) => { if (result[1].length === 0) {