-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
38 lines (36 loc) · 1014 Bytes
/
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
version: "3.9"
services:
# Even with all the following configuration
# It's still required to connect to mongo shell, and create both the DB
# and the user.
# otherwise, you will get an authentication issue.
# >> docker exec -it your-mongo-container bash
# >> mongo -u MY_USER -p MY_PASSWORD
# > use ptc
# > db.createUser({user: "mango", pwd: "bango", roles: [{role: "readWrite", db: "ptc"}]})
# you might also need:
# > db.what_even.insert({}) # this causes the db to appear in show dbs;
# Not sure if it has any effect though!
db:
image: mongo:latest
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: mango
MONGO_INITDB_ROOT_PASSWORD: bango
MONGO_INITDB_DATABASE: ptc
api:
image: ptc:latest
build:
context: .
dockerfile: Dockerfile
environment:
PORT: 80
DB_DSN: mongodb://mango:bango@db
env_file:
- src/.env
ports:
- "7999:80"
volumes:
- ./src:/src
depends_on:
- db