diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..8caeff0b2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.idea +*.md +docker-compose* +node_modules/ +npm-debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e77b382a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM amazeeio/node:8-builder as builder +COPY package.json package-lock.json /app/ +COPY packages /app/packages +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1 +RUN npm install + +FROM amazeeio/node:8 +COPY --from=builder /app/node_modules /app/node_modules +COPY . /app/ + +RUN mkdir -p /app/node_modules/.cache && fix-permissions /app/node_modules/.cache + +ENV HOST 0.0.0.0 +EXPOSE 3000 + +CMD ["npm", "start"] diff --git a/README.md b/README.md index 1b945c141..8697570f0 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,17 @@ npm test Before commit changes, run test first. If new Ripple components changed, we should update snapshots by `npm test -- -u`. Then add it in commit. +### Build Setup + +### Bay + +- `npm run bay:start` - build and start local development environment. +- `npm run bay:stop` - stop all Bay containers. +- `npm run bay:destroy` - stop and remove all Bay containers. +- `npm run bay:logs` - get logs from all running Bay containers. +- `npm run bay:cli` - run a command in `node` container. Example: `npm run bay:cli -- ls -al`. +- `npm run bay:pull` - pull latest Bay containers. + ## Export as a Static App We can export this Ripple storybook site as a stacic app. diff --git a/docker-compose.local.yml b/docker-compose.local.yml new file mode 100644 index 000000000..d2bc94f2d --- /dev/null +++ b/docker-compose.local.yml @@ -0,0 +1,14 @@ +version: '2' +services: + ripple: + networks: + - amazeeio-network + - default + volumes: + - .:/app:delegated + - /app/node_modules + environment: + LAGOON_ENVIRONMENT_TYPE: 'local' +networks: + amazeeio-network: + external: true diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..cfba1ea66 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '2' +services: + ripple: + build: + context: . + dockerfile: Dockerfile + networks: + - default + labels: + lagoon.type: node + environment: + - AMAZEEIO_URL=ripple.docker.amazee.io + - AMAZEEIO=AMAZEEIO + - AMAZEEIO_HTTP_PORT=3000 + ports: + - "9001:3000" diff --git a/package.json b/package.json index cf80012fb..dba71232f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dpc-sdp/ripple", - "version": "0.1.0", + "version": "0.1.1", "description": "Ripple", "contributors": [ "Tim Yao " @@ -12,7 +12,14 @@ "test": "NODE_ENV=test jest", "storybook": "start-storybook -p 3000 -c .storybook -s ./static", "build-storybook": "build-storybook -c .storybook -s ./static", - "start": "npm run storybook" + "start": "npm run storybook", + "bay:start": "docker-compose up -d", + "bay:rebuild-full": "docker-compose up -d --build --force-recreate", + "bay:restart": "docker-compose restart", + "bay:stop": "docker-compose stop", + "bay:destroy": "docker-compose down -v", + "bay:logs": "docker-compose logs", + "bay:cli": "docker exec -i $(docker-compose ps -q app)" }, "dependencies": { "@dpc-sdp/ripple-anchor-links": "file:packages/Molecules/AnchorLinks",