Skip to content

Commit

Permalink
Tarefa prática aserg-ufmg#2 - Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmoade committed Mar 12, 2021
1 parent 3cad745 commit fff7506
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"configurations": [
{
"name": "Docker Node.js Launch",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"platform": "node"
}
]
}
39 changes: 39 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "docker-build",
"label": "docker-build",
"platform": "node",
"dockerBuild": {
"dockerfile": "${workspaceFolder}/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
}
},
{
"type": "docker-run",
"label": "docker-run: release",
"dependsOn": [
"docker-build"
],
"platform": "node"
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"dockerRun": {
"env": {
"DEBUG": "*",
"NODE_ENV": "development"
}
},
"node": {
"enableDebugging": true
}
}
]
}
14 changes: 14 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.4'

services:
shopmicroservices:
image: shopmicroservices
build:
context: .
dockerfile: ./Dockerfile
environment:
NODE_ENV: development
ports:
- 3000:3000
- 9229:9229
command: ["node", "--inspect=0.0.0.0:9229", "index.js"]
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.4'

services:
shopmicroservices:
image: shopmicroservices
build:
context: .
dockerfile: ./Dockerfile
environment:
NODE_ENV: production
ports:
- 3000:3000
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Toy example of microservice",
"main": "",
"scripts": {
"start": "run-p start-frontend start-controller start-shipping start-inventory",
"start": "run-p start-frontend start-controller start-inventory",
"start-controller": "nodemon services/controller/index.js",
"start-shipping": "nodemon services/shipping/index.js",
"start-inventory": "nodemon services/inventory/index.js",
Expand Down
8 changes: 8 additions & 0 deletions shipping.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:12.18-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

0 comments on commit fff7506

Please sign in to comment.