Skip to content

Commit

Permalink
Docker Cloud integration (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahm authored Jun 28, 2017
1 parent cf53b02 commit 0e4880d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cache:
- "node_modules"

after_success:
- codecov
- codecov
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:8.1-slim

# get dependencies
ADD package.json /tmp/app-dev/package.json
RUN cd /tmp/app-dev && npm install --only=dev
RUN mkdir /tmp/app && cp /tmp/app-dev/package.json /tmp/app/ && \
cd /tmp/app && npm install --only=production

# build
ADD ./src /tmp/app-dev/src
ADD ./.babelrc /tmp/app-dev/.babelrc
RUN /tmp/app-dev/node_modules/.bin/babel /tmp/app-dev/src/ -d /tmp/app/dist --copy-files --ignore public/ && \
cp -r /tmp/app-dev/src/endpoints/directory_gui/public /tmp/app/dist/endpoints/directory_gui && \
rm /tmp/app/package-lock.json

FROM node:8.1-slim

EXPOSE 3000 4000
WORKDIR /opt/app

ENV NPM_CONFIG_LOGLEVEL warn

COPY --from=0 /tmp/app/ /opt/app

CMD npm start
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A contract is either a **Producer Promise** or a **Consumer Expectation**. In C7
To validate your contracts you need to issue a request to the [validation endpoint]. Ideally, this will be done automatically in your CI pipeline.

The validation process includes:

1. Syntactic validation
1. Check if all of the project's promises satisfy its consumers
1. Check if all of the project's expectations are honored by its upstream providers
Expand Down
2 changes: 1 addition & 1 deletion src/projects/helpers/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import config from '../../config';
import { ProjectWorkspace } from '../models';
import ProjectRepository from '../repositories/project';

const ORGANIZATION_NAME = 'goeuro';
const ORGANIZATION_NAME = 'omarahm'; //todo: make this configurable

export default {
/**
Expand Down
7 changes: 2 additions & 5 deletions tests/projects/helpers/sync_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ describe('syncProjectWorkspace() in the sync helper', () => {
});

it('downloads & unpacks correct contracts/ directory', async () => {
// I am using a dummy "ProjectWorkspace" to point to one of GoEuro's public repository
// at https://github.com/goeuro/challenges so the synchronization command can
// be tested without requiring a production token
const workspace = new models.ProjectWorkspace({
project: new models.Project({ repo: 'challenges', dir: 'bus_route_challenge' }),
project: new models.Project({ repo: 'notary', dir: 'examples/barebones' }),
rev: 'master'
});

await syncHelper.syncProjectWorkspace(workspace);

assert.isTrue(fs.existsSync(path.join(workspace.getContractsPath(), 'README.md')));
assert.isTrue(fs.existsSync(path.join(workspace.getContractsPath(), 'contracts.yml')));
}).timeout(15000);

it('throws an error for non-existing repository in Github', async () => {
Expand Down

0 comments on commit 0e4880d

Please sign in to comment.