Skip to content

Commit 6da01a0

Browse files
committed
add Dockerfile and docker-compose file
1 parent c03902b commit 6da01a0

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM maven:3.8.3-jdk-11 AS maven_build
2+
WORKDIR /tmp
3+
COPY pom.xml .
4+
COPY src/ ./src/
5+
RUN mvn package -Dmaven.test.skip=true
6+
7+
FROM openjdk:11
8+
COPY --from=maven_build /tmp/target/easy-notes-1.0.0.jar /data/easy-notes-1.0.0.jar
9+
EXPOSE 8080
10+
CMD java -jar /data/easy-notes-1.0.0.jar

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "3"
2+
services:
3+
app:
4+
image: spring-boot:latest
5+
restart: always
6+
ports:
7+
- 8080:8080
8+
depends_on:
9+
- db
10+
db:
11+
image: mysql
12+
restart: always
13+
expose:
14+
- 3306
15+
environment:
16+
- MYSQL_ROOT_PASSWORD=supersecretpassword
17+
- MYSQL_DATABASE=notes_app
18+
- MYSQL_USER=app
19+
- MYSQL_PASSWORD=secretpassword

src/main/resources/application.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
2-
spring.datasource.url = jdbc:mysql://localhost:3306/notes_app?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
3-
spring.datasource.username = root
4-
spring.datasource.password = callicoder
2+
spring.datasource.url = jdbc:mysql://db:3306/notes_app?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
3+
spring.datasource.username = app
4+
spring.datasource.password = secretpassword
55

66

77
## Hibernate Properties

0 commit comments

Comments
 (0)