Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a837fc

Browse files
author
Michel Eckhardt
committed
Docker added
1 parent 059bfdb commit 7a837fc

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM openjdk:11-jre-slim
2+
VOLUME /tmp
3+
ARG JAR_FILE=target/*.jar
4+
COPY ${JAR_FILE} app.jar
5+
ENTRYPOINT ["java","-jar","/app.jar"]

docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3'
2+
services:
3+
mysql:
4+
image: mysql
5+
restart: always
6+
environment:
7+
MYSQL_DATABASE: 'blogapi'
8+
MYSQL_USER: 'root'
9+
MYSQL_PASSWORD: 'root'
10+
MYSQL_ROOT_PASSWORD: 'root'
11+
ports:
12+
- '3306'
13+
networks:
14+
- production-network
15+
application:
16+
build:
17+
dockerfile: ./Dockerfile
18+
context: .
19+
image: michel-eckhardt/spring-boot-blog
20+
container_name: spring-boot-blog
21+
ports:
22+
- "8080:8080"
23+
networks:
24+
- production-network
25+
depends_on:
26+
- "mysql"
27+
networks:
28+
production-network:
29+
driver: bridge

src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
spring.jpa.hibernate.ddl-auto = none
22
spring.datasource.url = jdbc:mysql://localhost:3306/blogapi?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
3-
spring.datasource.username = admin
4-
spring.datasource.password = password
3+
spring.datasource.username = root
4+
spring.datasource.password = root
55

66
spring.jpa.show-sql = true
77

0 commit comments

Comments
 (0)