Two projects, the front and back ends are merged into one image and one container, and the implementation process is distinguished by ports
1. Two items, front and back end, two images, two containers. as shown in Figure 1
2. The front-end builds the directory structure. as shown in Figure 2
3. Interface construction directory structure. as shown in Figure 3
4. Relevant configuration of front-end construction. as shown in Figure 4
5. Relevant configuration of interface construction. as shown in Figure 5
6. Adjust the construction directory structure of the front end. Align the build as dist. Align the build_docker to build. Rename build_docker/c_files/config/init/config0.sh to build/c_files/config/init/config_front0.sh. Delete the Dockerfile. as shown in Figure 6
7. Adjust the Dockerfile in the build directory of the interface. as shown in Figure 7
8. In the configuration of Jenkins, Source Code Management – Multiple scms . Add 2 Git repositories. are the interface and front end respectively. as shown in Figure 8
9. In the configuration of Jenkins, build – docker build and publish . Tag: PCSFRONT_DEV_65E60624DCBC98445056A602D27C2552E58532DF_PCSAPI_DEV_$GIT_COMMIT. The commit ID of the front end needs to be changed manually every time. The commit ID of the interface, which can be read automatically. as shown in Figure 9
10. Check the directory structure in the container, both the front end and the interface exist. and can be accessed normally. in line with expectations. As shown in Figure 10
[root@api-5db464c777-fp9gk /]# cd /etc/nginx/conf.d/
[root@api-5db464c777-fp9gk conf.d]# ls -l
total 8
-rwxrwxr-x 1 root root 1109 Feb 23 15:33 pcs_api.conf
-rwxrwxr-x 1 root root 928 Feb 23 15:33 pcs_front.conf
[root@api-5db464c777-fp9gk conf.d]# cd /mcloud/www/
[root@api-5db464c777-fp9gk www]# ls -l
total 16
drwxrwxr-x 1 nginx nginx 4096 Feb 23 15:33 pcs_api
drwxrwxr-x 1 nginx nginx 4096 Feb 23 15:11 pcs_front
[root@api-5db464c777-fp9gk www]# curl http://api.pcs:82/api.txt
api
[root@api-5db464c777-fp9gk www]# curl http://api.pcs/front.txt
front
[root@api-5db464c777-fp9gk www]# curl http://pcsapi.dev.chinamcloud.cn/api.txt
api
[root@api-5db464c777-fp9gk www]# curl http://pcsfront.dev.chinamcloud.cn/front.txt
front
[root@api-5db464c777-fp9gk www]#









