Skip to content

Commit

Permalink
Build spring-boot
Browse files Browse the repository at this point in the history
  • Loading branch information
youweics committed Mar 14, 2019
1 parent 56c6912 commit d3e8be4
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 6 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
18 changes: 16 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,17 @@ 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
working_dir: /app
command: mvn clean spring-boot:run -Dspring-boot.run.profiles=docker -DskipTests
volumes:
- ./jvue-server:/app
- ./data/maven/.m2:/root/.m2
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
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
24 changes: 24 additions & 0 deletions jvue-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,35 @@
</dependencyManagement>

<build>
<finalName>jvue</finalName>
<plugins>
<!-- spring-boot-maven-plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- dockerfile-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.10</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>

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

0 comments on commit d3e8be4

Please sign in to comment.