Skip to content

Commit

Permalink
Dockerize (ovidiuch#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiuch authored Jun 8, 2020
1 parent 7bb3817 commit 492dcdd
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 38 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 5 additions & 0 deletions .env.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
ROLLBAR_POST_SERVER_ITEM_ACCESS_TOKEN: '',
ROLLBAR_POST_CLIENT_ITEM_ACCESS_TOKEN: '',
FIREBASE_SERVICE_ACCOUNT: '',
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ firebase-service-account.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.env.js
.env.prod.js
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:12
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn --frozen-lockfile
COPY . ./
RUN yarn build
EXPOSE 3000
CMD yarn start
25 changes: 25 additions & 0 deletions docker-compose-visual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3'
services:
cosmos:
image: buildkite/puppeteer:v3.0.4
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules/
entrypoint: /bin/sh -c
command:
- yarn --frozen-lockfile && yarn cosmos
regression:
image: buildkite/puppeteer:v3.0.4
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules
entrypoint: /bin/sh -c
command:
- npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual
depends_on:
- cosmos

volumes:
node_modules:
28 changes: 5 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
version: '3'
services:
cosmos:
image: buildkite/puppeteer:v3.0.4
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules/
entrypoint: /bin/sh -c
command:
- yarn --frozen-lockfile && yarn cosmos
regression:
image: buildkite/puppeteer:v3.0.4
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules
entrypoint: /bin/sh -c
command:
- npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual
depends_on:
- cosmos

volumes:
node_modules:
flatris:
build: .
ports:
- '3000:3000'
restart: unless-stopped
10 changes: 0 additions & 10 deletions now.json

This file was deleted.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"test": "jest",
"test:watch": "jest --watch",
"test:visual": "jest --no-cache --config jest.visual.config.js",
"test:visual:check": "docker-compose run --rm regression \"npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual\"",
"test:visual:update": "docker-compose run --rm regression \"npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual -u\"",
"test:visual:check": "docker-compose -f docker-compose-visual.yml run --rm regression \"npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual\"",
"test:visual:update": "docker-compose -f docker-compose-visual.yml run --rm regression \"npx wait-on http://cosmos:5000 && COSMOS_HOSTNAME=cosmos yarn test:visual -u\"",
"cosmos": "cosmos --config web/cosmos.config.json",
"cosmos:export": "cosmos-export --config web/cosmos.config.json",
"dev:client": "babel-node server/start-dev-client.js",
"dev:server": "babel-node server/start-dev-server.js",
"dev:server:watch": "nodemon server/start-dev-server.js --exec babel-node",
"build": "next build web",
"start": "babel-node server/start-prod.js"
"build": "env-cmd next build web",
"start": "env-cmd babel-node server/start-prod.js"
},
"dependencies": {
"body-parser": "^1.19.0",
Expand Down Expand Up @@ -59,6 +59,7 @@
"babel-loader": "^8.0.6",
"babel-plugin-module-resolver": "^4.0.0",
"css-loader": "^3.4.2",
"env-cmd": "^10.1.0",
"eslint": "^7.1.0",
"eslint-import-resolver-babel-module": "^5.1.2",
"eslint-plugin-babel": "^5.3.0",
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,7 @@ commander@^3.0.2:
resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e"
integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==

commander@^4.0.1, commander@^4.1.1:
commander@^4.0.0, commander@^4.0.1, commander@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
Expand Down Expand Up @@ -4206,6 +4206,14 @@ entities@^2.0.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4"
integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==

env-cmd@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b"
integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==
dependencies:
commander "^4.0.0"
cross-spawn "^7.0.0"

errno@^0.1.2, errno@^0.1.3, errno@^0.1.4, errno@~0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
Expand Down

0 comments on commit 492dcdd

Please sign in to comment.