Skip to content

Commit 674ff88

Browse files
committed
Docker files
1 parent f263eae commit 674ff88

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
.volumes/
2-
target/
32
.git

docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33

44
mariadb:
55
image: mariadb:10.6.1
6-
network_mode: host
6+
container_name: mariadb-container
77
restart: always
88
ports:
99
- 3306:3306
@@ -13,3 +13,17 @@ services:
1313
volumes:
1414
- ./.volumes/database:/var/lib/mysql
1515

16+
api:
17+
build: ./
18+
links:
19+
- mariadb
20+
depends_on:
21+
- mariadb
22+
restart: always
23+
ports:
24+
- 8080:8080
25+
environment:
26+
DB_URL: "mariadb:3306/common_app"
27+
DB_USERNAME: "root"
28+
DB_PASSWORD: "root"
29+

dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM openjdk:16
2+
3+
WORKDIR /app
4+
5+
COPY /target/api-3.0.0.jar /app/app.jar
6+
7+
ENTRYPOINT [ "java", "-jar", "app.jar" ]

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@
165165
<plugin>
166166
<groupId>org.springframework.boot</groupId>
167167
<artifactId>spring-boot-maven-plugin</artifactId>
168+
<configuration>
169+
<excludeDevtools>false</excludeDevtools>
170+
</configuration>
168171
<executions>
169172
<execution>
170173
<goals>

src/main/resources/application.properties

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ spring.jpa.show-sql=${show-sql:true}
1313

1414
# Banco de dados
1515
spring.datasource.hikari.maximum-pool-size=${max-connections:5}
16-
spring.datasource.url=jdbc:mysql://${db-url:localhost:3306/common_app}?useSSL=false&createDatabaseIfNotExist=true&serverTimezone=America/Sao_Paulo
17-
spring.datasource.username=${db-username:root}
18-
spring.datasource.password=${db-password:root}
16+
spring.datasource.url=jdbc:mysql://${DB_URL:localhost:3306/common_app}?useSSL=false&createDatabaseIfNotExist=true&serverTimezone=America/Sao_Paulo
17+
spring.datasource.username=${DB_USERNAME:root}
18+
spring.datasource.password=${DB_PASSWORD:root}
1919
spring.jpa.hibernate.ddl-auto=none
2020
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
2121
spring.jpa.properties.javax.persistence.validation.mode=none
@@ -46,3 +46,6 @@ spring.mail.properties.mail.smtp.starttls.enable=true
4646
# templates
4747
spring.resources.cache.period=0
4848

49+
# dev tools config
50+
spring.devtools.remote.secret=4ajG2rD
51+

0 commit comments

Comments
 (0)