Skip to content

Commit

Permalink
Added docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmugharajk committed Sep 23, 2018
1 parent 894f379 commit e4d9b92
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!./package.json
!./packages/game-server/package.json
!./packages/common/package.json

!./packages/game-server/dist
!./packages/game-server/client
!./packages/common/dist
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

FROM node:9.10.0-alpine

WORKDIR /app

COPY ./package.json .
COPY ./packages/game-server/package.json ./packages/game-server/
COPY ./packages/game-server/client/ ./packages/game-server/client/
COPY ./packages/common/package.json ./packages/common/

RUN npm i -g yarn
RUN yarn install --production

COPY ./packages/game-server/dist ./packages/game-server/dist
COPY ./packages/common/dist ./packages/common/dist

WORKDIR /app/packages/game-server

ENV NODE_ENV production

EXPOSE 4500

CMD ["node", "dist/index.js"]
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/nodemon", "**/nodemon/**"]
"nohoist": [
"**/nodemon",
"**/nodemon/**",
"**/rimraf",
"**/rimraf/**"
]
},
"scripts": {
"run-client": "cd ./packages/web && yarn start",
"run-server": "cd ./packages/game-server && yarn start",
"start": "yarn run run-server"

"build:client": "cd ./packages/web && yarn run build",
"build:common": "cd ./packages/common && yarn run build",
"build:server": "cd ./packages/game-server && yarn run build"
}
}
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"tslint": "^5.11.0",
"typescript": "^3.0.3"
}
}
}
6 changes: 4 additions & 2 deletions packages/game-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"jest": "^23.5.0",
"nodemon": "^1.18.4",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"ts-jest": "^23.1.4",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
Expand All @@ -28,7 +29,8 @@
"uuid": "^3.3.2"
},
"scripts": {
"start": "./node_modules/.bin/nodemon",
"test": "jest"
"start": "nodemon",
"test": "jest",
"build": "rimraf ./dist && tsc"
}
}
1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@types/react": "^16.4.14",
"@types/react-dom": "^16.0.7",
"@types/socket.io-client": "^1.4.32",
"rimraf": "^2.6.2",
"typescript": "^3.0.3"
},
"jest": {
Expand Down

0 comments on commit e4d9b92

Please sign in to comment.