Skip to content

Commit

Permalink
Merge pull request #36 from terwer/v4.x
Browse files Browse the repository at this point in the history
 Build spring-boot
  • Loading branch information
terwer authored Mar 14, 2019
2 parents 4f24001 + 7f9df91 commit e52d551
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 8 deletions.
27 changes: 27 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 构建docker-compose项目
# docker-compose up -V --force-recreate
# docker-compose up -d --force-recreate
version: '3'
services:
mysql:
privileged: true
container_name: jvue-mysql
build:
context: ./
dockerfile: ./jvue-mysql/Dockerfile
ports:
- "3306:3306"
environment:
# 最好使用此设定时区,其它静像也可以使用,也可以用"TZ=Asia/Shanghai"
- "TZ=CST-8"
- "MYSQL_ROOT_PASSWORD=123456"
- "MYSQL_ROOT_HOST=%"
- "MYSQL_DATABASE=testbugucms"
- "MYSQL_USER=test"
- "MYSQL_PASSWORD=123456"
volumes:
- ./data/mysql/db:/var/db
- ./data/mysql/log:/var/log
- ./jvue-mysql/my.cnf:/etc/my.cnf
- ./jvue-mysql/init:/docker-entrypoint-initdb.d/
restart: always
21 changes: 19 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# docker-compose up -d --force-recreate
version: '3'
services:
mysql:
jvue-mysql:
privileged: true
image: jvue/mysql:5.7.24
container_name: jvue-mysql
build:
context: ./
Expand All @@ -24,4 +25,20 @@ services:
- ./data/mysql/log:/var/log
- ./jvue-mysql/my.cnf:/etc/my.cnf
- ./jvue-mysql/init:/docker-entrypoint-initdb.d/
restart: always
restart: always
jvue-server:
privileged: true
image: jvue/server:4.0.0
container_name: jvue-server
build:
context: ./
dockerfile: ./jvue-server/Dockerfile
ports:
- "8081:8081"
working_dir: /app
command: mvn clean spring-boot:run -Dspring-boot.run.profiles=docker -DskipTests
volumes:
- ./jvue-server:/app
- ./data/maven/.m2:/root/.m2
- ./data/server/logs:/logs
restart: always
6 changes: 2 additions & 4 deletions jvue-mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 构建镜像
# docker build . -t jvue-mysql:5.7.24 --force-rm --no-cache
# docker build . -t jvue-mysql:5.7.24 --force-rm --no-cache

# 运行容器
# docker run --name=jvue-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 jvue-mysql:5.7.24
Expand All @@ -21,6 +21,4 @@ MAINTAINER terwer "csyouwei@gmail.com"
ENV LANG C.UTF-8
# 设置时区
# ENV TZ Asia/Shanghai
ENV TZ CST-8
#容器运行时启动的命令,下面命令等价于 CMD echo 'TZ is:'$TZ
RUN echo 'LANG is:'$LANG',TZ is:'$TZ
ENV TZ CST-8
4 changes: 2 additions & 2 deletions jvue-mysql/init/init.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 数据库已经配置,这里不指定
-- 数据库已经配置,这里不指定
-- DROP DATABASE IF EXISTS testbugucms;
-- CREATE DATABASE testbugucms CHARACTER SET utf8 COLLATE utf8_general_ci;
USE testbugucms;

# 用户已经指定,不要创建
-- 用户已经指定,不要创建
-- CREATE USER 'test'@'%' IDENTIFIED BY '123456';
-- GRANT All privileges ON *.* TO '123456'@'%';

Expand Down
12 changes: 12 additions & 0 deletions jvue-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 构建镜像
# docker build . -t jvue-server:4.0.0 --force-rm --no-cache

#依赖的镜像
FROM maven:3.6.0-jdk-8
#镜像创建者的信息
MAINTAINER terwer "csyouwei@gmail.com"
# 设置编码
ENV LANG C.UTF-8
# 设置时区
# ENV TZ Asia/Shanghai
ENV TZ CST-8
2 changes: 2 additions & 0 deletions jvue-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@
</dependencyManagement>

<build>
<finalName>jvue</finalName>
<plugins>
<!-- spring-boot-maven-plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
21 changes: 21 additions & 0 deletions jvue-server/src/main/resources/application-docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ================================================
# 项目基本配置
# ================================================
server.port=8081

# ================================================
# DataSource配置
# ================================================
# MyBatis
mybatis.mapper-locations=classpath:mappers/*.xml
# MySQL
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:MySQL://39.104.66.135:3306/testbugucms?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=test
spring.datasource.password=ABCdef123456!#
# PageHelper
pagehelper.helperDialect=mysql
#pagehelper.helperDialect=oracle
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
4 changes: 4 additions & 0 deletions jvue-server/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="logFilePath" value="${catalina.base}/logs" />
</springProfile>
<springProfile name="docker">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="logFilePath" value="/logs" />
</springProfile>

<property name="log.context.name" value="JVueApplication" />
<property name="log.charset" value="UTF-8" />
Expand Down

0 comments on commit e52d551

Please sign in to comment.