Skip to content

Commit

Permalink
add a docker compose build
Browse files Browse the repository at this point in the history
  • Loading branch information
dafengzhen committed Mar 17, 2024
1 parent 23229c6 commit f9cf2a0
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ README.md
mvnw
mvnw.cmd
compose.yaml
docker-compose.yml
google_checks.xml
HELP.md
LICENSE
web
.idea
target
logs
indexs
docs
hosting
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Image
TAG=dev

# Database
DATABASE_ENDPOINT=youdeyiwu:3306
DATABASE_USERNAME=root
DATABASE_PASSWORD=123456
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,7 @@ fabric.properties
# vuepress build output
.vuepress/dist
.vuepress/cache

# custom
logs
indexs
7 changes: 0 additions & 7 deletions compose.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3"
services:
youdeyiwu:
labels:
- maintainer=dafengzhen
- description=Build youdeyiwu backend application
container_name: youdeyiwu
image: "youdeyiwu:${TAG}"
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://${DATABASE_ENDPOINT}/youdeyiwu?createDatabaseIfNotExist=true&serverTimezone=UTC&allowMultiQueries=true
- SPRING_DATASOURCE_USERNAME=${DATABASE_USERNAME}
- SPRING_DATASOURCE_PASSWORD=${DATABASE_PASSWORD}
build:
context: .
networks:
- server
volumes:
- logs:/youdeyiwu/logs
restart: on-failure
ports:
- "8080:8080"

networks:
server:

volumes:
logs:
3 changes: 3 additions & 0 deletions src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# log
logging.level.web = debug

# jpa
spring.jpa.hibernate.ddl-auto = update

Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ server.tomcat.remoteip.protocol-header = x-forwarded-proto
spring.application.name = youdeyiwu
spring.data.web.pageable.default-page-size = 15
spring.data.web.pageable.max-page-size = 25
logging.level.web = debug

# log
logging.level.web = info
logging.charset.file= UTF-8
logging.charset.console = UTF-8
logging.file.name = logs/application.log

# docker
spring.docker.compose.enabled = false
Expand Down

0 comments on commit f9cf2a0

Please sign in to comment.