Skip to content

Commit

Permalink
Merge pull request #37 from terwer/v4.x
Browse files Browse the repository at this point in the history
 Use nginx proxy jvue-server
  • Loading branch information
terwer authored Mar 15, 2019
2 parents e52d551 + d966792 commit 5ce05b2
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# 构建docker-compose项目
# docker-compose up
# docker-compose up -V --force-recreate
# docker-compose up -d --force-recreate
version: '3'
services:
mysql:
jvue-nginx:
privileged: true
image: jvue/nginx:1.15.9
container_name: jvue-nginx
build:
context: ./
dockerfile: ./jvue-nginx/Dockerfile
ports:
- "80:80"
volumes:
- ./jvue-nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./data/nginx/log:/var/log/nginx
jvue-mysql:
privileged: true
image: jvue/mysql:5.7.24
container_name: jvue-mysql
build:
context: ./
Expand All @@ -24,4 +38,20 @@ services:
- ./data/mysql/log:/var/log
- ./jvue-mysql/my.cnf:/etc/my.cnf
- ./jvue-mysql/init:/docker-entrypoint-initdb.d/
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
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# 构建docker-compose项目
# docker-compose up
# docker-compose up -V --force-recreate
# docker-compose up -d --force-recreate
version: '3'
services:
jvue-nginx:
privileged: true
image: jvue/nginx:1.15.9
container_name: jvue-nginx
build:
context: ./
dockerfile: ./jvue-nginx/Dockerfile
ports:
- "80:80"
volumes:
- ./jvue-nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./data/nginx/log:/var/log/nginx
jvue-mysql:
privileged: true
image: jvue/mysql:5.7.24
Expand Down
11 changes: 11 additions & 0 deletions jvue-nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#依赖的镜像
FROM nginx:1.15.9-alpine
#镜像创建者的信息
MAINTAINER terwer "csyouwei@gmail.com"
# 设置编码
ENV LANG C.UTF-8
# 设置时区
# ENV TZ Asia/Shanghai
ENV TZ CST-8
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
14 changes: 14 additions & 0 deletions jvue-nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 80;
charset utf-8;

location /api/ {
proxy_set_header X-Real-IP $remote_addr; # 转发用户IP
proxy_pass http://jvue-server:8081; # jvue-server
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 5ce05b2

Please sign in to comment.