generated from davidlm97/express-ts-babel-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
44 lines (41 loc) · 1.44 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Si se necesita instalar alguna libreria hacerlo dentro del contenedor con: `docker exec issue-tracker-api_api_1 npm install ...`
## - Para que funcione correctamente hay que hacer `docker-compose up --build` por que los paquetes se instalan en el Dockerfile
version: "3.8"
services:
mongo:
image: mongo:5.0.6-focal
command: --quiet
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE}
MONGO_DB_USER_NAME: ${MONGO_DB_USER_NAME}
MONGO_DB_USER_PASSWORD: ${MONGO_DB_USER_PASSWORD}
ports:
- 27017:27017
volumes:
- mongodata:/data/db
- ./mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro
api:
image: node:16.14-stretch # TODO problems with mongodb-memory-server, do a docker with other node contaier smaller and adding packages so we can use memory server
restart: always
user: node
working_dir: /usr/src/app
command: sh -c "npm install && npm run start-dev"
ports:
- "3000:3000"
volumes:
- .:/usr/src/app
environment:
NODE_ENV: ${NODE_ENV}
DB_HOST: ${RESOURCE_DB_HOST}
DB_PORT: ${RESOURCE_DB_PORT}
DB_NAME: ${RESOURCE_DB_NAME}
DB_USER: ${RESOURCE_DB_USER}
DB_PASSWORD: ${RESOURCE_DB_PASSWORD}
depends_on:
- "mongo"
volumes:
mongodata:
external: false