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/
1
+ version : ' 3.8' # Specify version to ensure compatibility
4
2
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
3
services :
11
4
server :
12
- build :
13
- context : .
5
+ image : olegselajev241/todo-demo-application
14
6
ports :
15
7
- 8080:8080
8
+ depends_on :
9
+ - db # Ensure the database starts before the app
10
+ environment :
11
+ POSTGRES_HOST : db
12
+ POSTGRES_PORT : 5432
13
+ POSTGRES_USER : postgres
14
+ POSTGRES_PASSWORD : postgres # Update with your actual password
15
+ POSTGRES_DB : postgres # Update with your database name
16
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
-
47
- # secrets:
48
- # db-password:
49
- # file: db/password.txt
50
-
17
+ db :
18
+ image : postgres
19
+ restart : always
20
+ environment :
21
+ POSTGRES_USER : postgres
22
+ POSTGRES_PASSWORD : postgres # Update with your actual password
23
+ POSTGRES_DB : postgres # Update with your database name
24
+ ports :
25
+ - 5432:5432 # Expose the Postgres port
26
+ healthcheck :
27
+ test : ["CMD", "pg_isready", "-U", "postgres"]
28
+ interval : 10s
29
+ timeout : 5s
30
+ retries : 5
0 commit comments