app-web模块
maven编译后,会将app-web模块打包成war包,可以使用tomcat作为基础镜像进行制作。
Dockerfile示例:
system-server模块
maven编译后,会将system-server模块打包成jar包(SpringBoot项目),可以使用openjdk作为基础镜像进行制作。
Dockerfile示例:
vue项目
Nginx基础镜像打包
使用Nginx作为基础镜像。
nginx配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
underscores_in_headers on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
location /xxx/xxx {
proxy_pass http://service-xxx:8093/xxx/xxx;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Frame-Options;
add_header X-Frame-Options ALLOWALL;
}
location /xxx {
proxy_pass http://service-xxx:8080/xxx;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Frame-Options;
add_header X-Frame-Options ALLOWALL;
}
location /xxxxxxxx {
root /usr/share/nginx/html/;
}
}
}
旧的httpd作为基础镜像打包
F5只映射了一个地址,所以需要前端部署为Nginx。目前已不再使用httpd打包。
Node会将vue项目打包编译成镜像页面,可以使用httpd作为基础镜像进行制作。
Dockerfile示例:
1
2
3
4
5
6
7
8
9
10
FROM httpd:2.4.61
LABEL maintainer="lalala"
设置时区为上海东八区
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" >/etc/timezone
将编译生成的dist下的文件复制到容器/usr/local/apache2/htdocs中
COPY dist/ /usr/local/apache2/htdocs/myproject-vue/
暴露httpd的80端口
EXPOSE 80