-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (52 loc) · 1.84 KB
/
docker-compose.yml
File metadata and controls
54 lines (52 loc) · 1.84 KB
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
45
46
47
48
49
50
51
52
53
54
version: '3.9'
services:
springboot-app:
build:
context: . # Use the current directory as the build context
dockerfile: Dockerfile # Use the Dockerfile in the current directory
container_name: springboot-application
expose:
- 8080
ports:
- "8080:8080" # Map your Spring Boot app's port to the host
depends_on:
- elasticsearch
- postgres
restart: on-failure
environment:
SPRING_APPLICATION_JSON: '{
"spring.datasource.url": "jdbc:postgresql://postgres:5432/your_db_name?user=your_db_username&password=your_db_password",
"spring.datasource.username": "your_db_username",
"spring.datasource.password": "your_db_password",
"spring.datasource.driverClassName": "org.postgresql.Driver",
"spring.jpa.hibernate.ddl-auto": "update",
"spring.elasticsearch.uris": "http://elasticsearch:9200",
"spring.elasticsearch.username": "elastic",
"spring.elasticsearch.password": "password"
}'
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
container_name: elasticsearch
expose:
- 9200
ports:
- "9200:9200" # Expose Elasticsearch HTTP API port
- "9300:9300" # Expose Elasticsearch transport port
environment:
- "node.name=elasticsearch"
- "discovery.type=single-node" # Run Elasticsearch as a single node
- "cluster.name=my-custom-cluster" # Specify a custom cluster name
- "xpack.security.enabled=true" # Enable security
- "xpack.security.authc.anonymous.username=elastic"
- "ELASTIC_PASSWORD=password"
postgres:
image: postgres:13
container_name: postgres
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_DB: your_db_name
POSTGRES_USER: your_db_username
POSTGRES_PASSWORD: your_db_password