Skip to content

Commit 9723858

Browse files
Feat: Dockerize the application
1 parent a29a4a6 commit 9723858

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM eclipse-temurin:17-jdk-alpine
2+
VOLUME /tmp
3+
COPY target/order-0.0.1-SNAPSHOT.jar order-0.0.1-SNAPSHOT.jar
4+
ENTRYPOINT ["java","-jar","/order-0.0.1-SNAPSHOT.jar"]
5+

docker-compose.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@ version: '3.1'
22

33
services:
44
postgres:
5-
container_name: order-postgresDB
65
image: postgres:14.5-alpine
76
user: postgres
87
environment:
9-
POSTGRES_USER: postgres
10-
POSTGRES_PASSWORD: postgres
11-
POSTGRES_DB: order_db
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
- POSTGRES_DB=order_db
11+
1212
ports:
13-
- '5432:5432'
13+
- 5432:5432
1414
volumes:
1515
- order-postgres:/var/lib/postgresql/data
16-
17-
1816

1917

18+
order:
19+
depends_on:
20+
- postgres
21+
build:
22+
context: .
23+
dockerfile: Dockerfile
24+
environment:
25+
- SPRING.DATASOURCE.URL=jdbc:postgresql://postgres:5432/order_db
26+
- SPRING.DATASOURCE.USERNAME=postgres
27+
- SPRING.DATASOURCE.PASSWORD=postgres
28+
ports:
29+
- 8080:8080
30+
2031
volumes:
2132
order-postgres:
2233
driver: local

0 commit comments

Comments
 (0)