Skip to content

Commit

Permalink
Merge 2921ab6 into 1e6c2dc
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-napoleone committed Jun 28, 2018
2 parents 1e6c2dc + 2921ab6 commit 380bf49
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 27 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

45 changes: 32 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
dist: trusty
language: node_js
node_js:
- '8'
sudo: required
before_install:
- if [[ `npm -v` != 6* ]]; then npm i -g npm@6; fi
install:
- npm install
- echo $COVERALLS_TOKEN >> .coveralls.yml
script:
- npm run lint
- npm run test
- npm run coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
language: node_js
node_js: "8"

jobs:
include:
- stage: Lint
script: npm run lint
- stage: Test
- stage: Coverage
script: npm run coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
- stage: Build and push Docker images
install: skip
script: skip
services:
- docker
before_install:
- docker build -t tomochain/tomomaster .
deploy:
provider: script
script: bash docker_push.sh
on:
branch: master
- stage: Trigger rebuild of infrastructure images
sudo: false
install: skip
script: bash docker_rebuild.sh

stages:
- name: Build and push Docker images
if: type != pull_request AND branch = master
- name: Trigger rebuild of infrastructure images
if: type != pull_request AND branch = master
30 changes: 20 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
FROM node:8
FROM node:8-alpine

WORKDIR /build
LABEL maintainer="etienne@tomochain.com"

RUN npm install -g pm2
COPY ./package.json /build
COPY ./package-lock.json /build
RUN npm install
COPY ./ /build
RUN npm run build && rm -rf /build/node_modules
ENV HOST 0.0.0.0

RUN npm install --production
WORKDIR /app

COPY . .

RUN apk --no-cache --virtual deps add \
python \
make \
g++ \
bash \
git \
&& npm install -g pm2 truffle \
&& npm install \
&& truffle deploy \
&& npm run build \
&& rm -rf node_modules \
&& npm install --production \
&& apk del deps

RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
15 changes: 15 additions & 0 deletions Dockerfile.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:8

WORKDIR /build

RUN npm install -g pm2
COPY ./package.json /build
COPY ./package-lock.json /build
RUN npm install
COPY ./ /build
RUN npm run build && rm -rf /build/node_modules

RUN npm install --production

RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
4 changes: 3 additions & 1 deletion docker-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ services:
- "443:443"

tomomaster:
build: ./
build:
context: ./
dockerfile: Dockerfile.old
image: tomochain/tomomaster
restart: "on-failure:10"
depends_on:
Expand Down
7 changes: 7 additions & 0 deletions docker_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker tag tomochain/tomomaster tomochain/tomomaster:latest
docker tag tomochain/tomomaster tomochain/tomomaster:$TRAVIS_BUILD_ID
docker push tomochain/tomomaster:latest
docker push tomochain/tomomaster:$TRAVIS_BUILD_ID
1 change: 1 addition & 0 deletions docker_rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -X POST $INFRA_IMAGE_REBUILD_HOOK
4 changes: 2 additions & 2 deletions entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/sh

echo "Generating Configuration File ..."
cp /build/config/default.json /build/config/local.json
cp ./config/default.json ./config/local.json

pm2 start -x ./services/crawl.js
pm2 start -x --no-daemon index.js

0 comments on commit 380bf49

Please sign in to comment.