Skip to content

Commit

Permalink
Docker funcionandp
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterJackpot committed Sep 11, 2019
1 parent efd5655 commit 9791c73
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM node:latest

RUN mkdir -p /usr/src/app
RUN mkdir -p /app

WORKDIR /usr/src/app
WORKDIR /app

COPY package*.json /usr/src/app/
COPY package*.json /app/

RUN npm install

COPY . /usr/src/app
COPY . /app

RUN wget https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh -O wait-for-it.sh && chmod +x wait-for-it.sh

EXPOSE 4301

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- "4301"
ports:
- "4301:4000"
command: ["npx","sequelize","db:migrate","&&","npm", "start"]
command: ["./wait-for-it.sh", "-t", "0", "iberedb:3306", "--","npx","sequelize","db:migrate","&&","npm","start", ]
networks:
- ibere-network

Expand Down
19 changes: 8 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
version: '2.0'
services:
nodejs:
api:
build:
context: .
dockerfile: Dockerfile
image: nodejs
container_name: nodejs
container_name: api
restart: always
env_file: .env-docker
ports:
- "3001:3000"
volumes:
- ./src:/usr/src/app/src
- node_modules:/usr/src/app/node_modules
networks:
- app-network
depends_on:
- db_mysql
db_mysql:
- iberedb
command: ["./wait-for-it.sh", "-t", "0", "iberedb:3306", "--", "npm","start", ]
iberedb:
image: mysql:5.7
restart: always
container_name: db_mysql
container_name: iberedb
environment:
MYSQL_DATABASE: 'db'
# So you don't have to use root, but you can if you like
Expand All @@ -37,7 +35,7 @@ services:
- '3306'
# Where our data will be persisted
volumes:
- my-db:/var/lib/mysql
- iberedb:/var/lib/mysql
networks:
- app-network
# Networks
Expand All @@ -46,5 +44,4 @@ networks:
driver: bridge
# Names our volume
volumes:
my-db:
node_modules:
iberedb:
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"html"
],
"collectCoverageFrom": [
"src/business/**/*.js",
"src/infrastructure/**/*.js"
"src/business/**/*.js"
]
}
}
2 changes: 0 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const swaggerJSDoc = require('swagger-jsdoc');
const options = require('../swagger-options');

//Import das rotas
const usersRouter = require('./api/user/usersRest');
const institutionRouter = require ('./api/instituicao/instituicaoRest');

const app = express();
Expand All @@ -25,7 +24,6 @@ app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

//Adicionando rotas na aplicação
app.use('/users', usersRouter);
app.use('/api/v1/instituicao', institutionRouter);

module.exports = app;

0 comments on commit 9791c73

Please sign in to comment.