Skip to content

Commit eeeee4e

Browse files
Dockerize the application
1 parent 7754fe5 commit eeeee4e

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target
2+
logs

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM eclipse-temurin:17-jdk-jammy AS builder
2+
WORKDIR /opt/app
3+
COPY .mvn/ .mvn
4+
COPY mvnw pom.xml ./
5+
RUN ./mvnw dependency:go-offline
6+
COPY ./src ./src
7+
RUN ./mvnw clean package -D skipTests
8+
9+
FROM eclipse-temurin:17-alpine
10+
WORKDIR /opt/app
11+
EXPOSE 8080
12+
COPY --from=builder /opt/app/target/*.jar /opt/app/*.jar
13+
ENTRYPOINT ["java", "-jar", "/opt/app/*.jar" ]

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ version: '3.1'
22

33
services:
44

5+
app:
6+
image: 'order_management'
7+
build:
8+
context: .
9+
depends_on:
10+
- postgres
11+
ports:
12+
- "8080:8080"
13+
environment:
14+
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/order_management
15+
- SPRING_DATASOURCE_USERNAME=postgres
16+
- SPRING_DATASOURCE_PASSWORD=postgres
17+
- SPRING_JPA_HIBERNATE_DDL_AUTO=none
18+
519
postgres:
620
image: postgres:15.2-alpine
721
restart: always

0 commit comments

Comments
 (0)