jaothan commited on
Commit
a97234e
·
verified ·
1 Parent(s): 79f7ddb

Update compose.yaml

Browse files
Files changed (1) hide show
  1. compose.yaml +84 -49
compose.yaml CHANGED
@@ -1,49 +1,84 @@
1
- # Comments are provided throughout this file to help you get started.
2
- # If you need more help, visit the Docker Compose reference guide at
3
- # https://docs.docker.com/go/compose-spec-reference/
4
-
5
- # Here the instructions define your application as a service called "server".
6
- # This service is built from the Dockerfile in the current directory.
7
- # You can add other services your application may depend on here, such as a
8
- # database or a cache. For examples, see the Awesome Compose repository:
9
- # https://github.com/docker/awesome-compose
10
- services:
11
- server:
12
- build:
13
- context: .
14
- ports:
15
- - 8000:8000
16
-
17
- # The commented out section below is an example of how to define a PostgreSQL
18
- # database that your application can use. `depends_on` tells Docker Compose to
19
- # start the database before your application. The `db-data` volume persists the
20
- # database data between container restarts. The `db-password` secret is used
21
- # to set the database password. You must create `db/password.txt` and add
22
- # a password of your choosing to it before running `docker compose up`.
23
- # depends_on:
24
- # db:
25
- # condition: service_healthy
26
- # db:
27
- # image: postgres
28
- # restart: always
29
- # user: postgres
30
- # secrets:
31
- # - db-password
32
- # volumes:
33
- # - db-data:/var/lib/postgresql/data
34
- # environment:
35
- # - POSTGRES_DB=example
36
- # - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
37
- # expose:
38
- # - 5432
39
- # healthcheck:
40
- # test: [ "CMD", "pg_isready" ]
41
- # interval: 10s
42
- # timeout: 5s
43
- # retries: 5
44
- # volumes:
45
- # db-data:
46
- # secrets:
47
- # db-password:
48
- # file: db/password.txt
49
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Comments are provided throughout this file to help you get started.
2
+ # If you need more help, visit the Docker Compose reference guide at
3
+ # https://docs.docker.com/go/compose-spec-reference/
4
+
5
+ # Here the instructions define your application as a service called "server".
6
+ # This service is built from the Dockerfile in the current directory.
7
+ # You can add other services your application may depend on here, such as a
8
+ # database or a cache. For examples, see the Awesome Compose repository:
9
+ # https://github.com/docker/awesome-compose
10
+ #services:
11
+ # server:
12
+ # build:
13
+ # context: .
14
+ # ports:
15
+ # - 8000:8000
16
+
17
+
18
+ version: '3.8'
19
+
20
+ services:
21
+ mongodb:
22
+ image: mongo:6.0
23
+ ports:
24
+ - "27017:27017"
25
+ environment:
26
+ - MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
27
+ - MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
28
+ healthcheck:
29
+ test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
30
+ interval: 5s
31
+ timeout: 3s
32
+ retries: 5
33
+ volumes:
34
+ - mongodb_data:/data/db
35
+
36
+ app:
37
+ image: your-app-image:latest
38
+ env_file:
39
+ - .env
40
+ depends_on:
41
+ mongodb:
42
+ condition: service_healthy
43
+ ports:
44
+ - "3000:3000"
45
+ environment:
46
+ - MONGO_URI=mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@mongodb:27017/
47
+ - MONGO_DB_NAME=${MONGO_DB_NAME}
48
+
49
+ volumes:
50
+ mongodb_data:
51
+
52
+ # The commented out section below is an example of how to define a PostgreSQL
53
+ # database that your application can use. `depends_on` tells Docker Compose to
54
+ # start the database before your application. The `db-data` volume persists the
55
+ # database data between container restarts. The `db-password` secret is used
56
+ # to set the database password. You must create `db/password.txt` and add
57
+ # a password of your choosing to it before running `docker compose up`.
58
+ # depends_on:
59
+ # db:
60
+ # condition: service_healthy
61
+ # db:
62
+ # image: postgres
63
+ # restart: always
64
+ # user: postgres
65
+ # secrets:
66
+ # - db-password
67
+ # volumes:
68
+ # - db-data:/var/lib/postgresql/data
69
+ # environment:
70
+ # - POSTGRES_DB=example
71
+ # - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
72
+ # expose:
73
+ # - 5432
74
+ # healthcheck:
75
+ # test: [ "CMD", "pg_isready" ]
76
+ # interval: 10s
77
+ # timeout: 5s
78
+ # retries: 5
79
+ # volumes:
80
+ # db-data:
81
+ # secrets:
82
+ # db-password:
83
+ # file: db/password.txt
84
+