-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
162 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="campus-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> | ||
<deployment type="dockerfile"> | ||
<settings> | ||
<option name="imageTag" value="campus/campus-server:1.1.8" /> | ||
<option name="buildOnly" value="true" /> | ||
<option name="sourceFilePath" value="campus-modular/Dockerfile" /> | ||
</settings> | ||
</deployment> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#FROM java:8 | ||
FROM openjdk:8 | ||
|
||
MAINTAINER oddfar | ||
|
||
# 创建目录 | ||
RUN mkdir -p /home/campus/conf | ||
|
||
WORKDIR /home/campus | ||
|
||
ENV SERVER_PORT=8160 | ||
|
||
EXPOSE ${SERVER_PORT} | ||
|
||
ADD ./target/campus-modular.jar ./app.jar | ||
|
||
ENTRYPOINT ["java", \ | ||
"-Djava.security.egd=file:/dev/./urandom", \ | ||
"-Dserver.port=${SERVER_PORT}", \ | ||
"-jar", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
version : '3' | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
container_name: mysql | ||
environment: | ||
# root 密码 | ||
MYSQL_ROOT_PASSWORD: 123456789 | ||
# 初始化数据库(后续的初始化sql会在这个库执行) | ||
MYSQL_DATABASE: 'oddfar_campus' | ||
volumes: | ||
# 数据挂载 | ||
- /docker/mysql/data/:/var/lib/mysql/ | ||
# 配置挂载 | ||
- /docker/mysql/conf/:/etc/mysql/conf.d/ | ||
# 日志 | ||
- /docker/mysql/logs:/logs | ||
command: [ | ||
'mysqld', | ||
'--innodb-buffer-pool-size=80M', | ||
'--character-set-server=utf8mb4', | ||
'--collation-server=utf8mb4_unicode_ci', | ||
'--default-time-zone=+8:00', | ||
'--lower-case-table-names=1' | ||
] | ||
privileged: true | ||
network_mode: "host" | ||
|
||
redis: | ||
image: redis:6.2.12 | ||
container_name: redis | ||
volumes: | ||
# 配置文件 | ||
- /docker/redis/conf:/redis/config | ||
# 数据文件 | ||
- /docker/redis/data/:/redis/data/ | ||
command: "redis-server /redis/config/redis.conf" | ||
privileged: true | ||
network_mode: "host" | ||
|
||
|
||
nginx-web: | ||
image: nginx:1.23.4 | ||
container_name: nginx-web | ||
environment: | ||
# 时区上海 | ||
TZ: Asia/Shanghai | ||
volumes: | ||
# 页面目录 | ||
- /docker/nginx/html:/usr/share/nginx/html | ||
# 证书映射 | ||
- /docker/nginx/cert:/etc/nginx/cert | ||
# 配置文件映射 | ||
- /docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf | ||
# 日志目录 | ||
- /docker/nginx/log:/var/log/nginx | ||
privileged: true | ||
network_mode: "host" | ||
|
||
campus-server: | ||
image: campus/campus-server:1.1.8 | ||
container_name: campus-server | ||
environment: | ||
# 时区上海 | ||
TZ: Asia/Shanghai | ||
SERVER_PORT: 8160 | ||
# spring.config.additional-location: /home/campus/conf/application-prod.yml | ||
volumes: | ||
- /docker/server/conf:/home/campus/conf | ||
privileged: true | ||
network_mode: "host" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
# https配置参考 start | ||
#listen 443 ssl; | ||
|
||
# 证书直接存放 /docker/nginx/cert/ 目录下即可 更改证书名称即可 无需更改证书路径 | ||
#ssl on; | ||
#ssl_certificate /etc/nginx/cert/xxx.local.crt; # /etc/nginx/cert/ 为docker映射路径 不允许更改 | ||
#ssl_certificate_key /etc/nginx/cert/xxx.local.key; # /etc/nginx/cert/ 为docker映射路径 不允许更改 | ||
#ssl_session_timeout 5m; | ||
#ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; | ||
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
#ssl_prefer_server_ciphers on; | ||
# https配置参考 end | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
try_files $uri $uri/ /index.html; | ||
index index.html index.htm; | ||
} | ||
|
||
location /prod-api/{ | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header REMOTE-HOST $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_pass http://127.0.0.1:8160/; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# redis 密码 | ||
# requirepass 123456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
数据目录 请执行 `chmod 777 /docker/redis/data` 赋予读写权限 否则将无法写入数据 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
若您需要挂载使用外部配置文件 | ||
|
||
在 `/docker/server/conf` 创建 `application-prod.yml` 文件 | ||
|
||
并 `Environment` 加 `spring.config.additional-location: /home/campus/conf/application-prod.yml` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters