Skip to content

Commit

Permalink
添加docker脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
xulang committed Jan 23, 2019
1 parent dc25613 commit e9bf70b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM maven:3.5.4-jdk-8
MAINTAINER langhsu

ENV TZ=Asia/Shanghai mysql_user="root" mysql_password="root"
RUN mkdir /app && ln -sf /usr/share/zoneinfo/{TZ} /etc/localtime && echo "{TZ}" > /etc/timezone

WORKDIR /app
ADD mblog-latest.jar mblog-latest.jar
ENTRYPOINT ["java", "-jar", "/opt/mblog/mblog-latest.jar", "--spring.datasource.username=${mysql_user}","--spring.datasource.password=${mysql_password}"]
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'
services:
mysql:
container_name: mblog-mysql
image: mysql/mysql-server:5.7
expose:
- "3306"
volumes:
- ./src/main/resources/db/migration:/docker-entrypoint-initdb.d
- ./mysql/mysql_data:/var/lib/mysql
restart: always

server:
container_name: mblog
build: .
working_dir: /app
environment:
TZ: Asia/Shanghai
volumes:
- ./:/app
- ~/.m2:/root/.m2
- ./logs:/app/logs
ports:
- "80:8080"
command: mvn clean spring-boot:run -Dspring-boot.run.profiles=mysql -Dmaven.test.skip=true
depends_on:
- mysql
restart: always

0 comments on commit e9bf70b

Please sign in to comment.