在Jenkins进行简单的自动化部署
在 Jenkins 进行简单的自动化部署 简单自动化部署前端项目 1.首先需要在自己项目里存放四个文件 deploy.sh #!/bin/bash docker-compose -f docker-compose.yml up --build -d docker-compose.yml version: "3" services: archetype-web: # 如果需要指定版本 就把 latest 换成版本号 build: ./ image: archetype-web:latest container_name: archetype-web ports: - "10231:80" privileged: true restart: always Dockerfile FROM nginx COPY dist/ /usr/share/nginx/html/ COPY nginx.conf /etc/nginx/conf.d/default.conf nginx.conf #开启gzip功能 gzip on; #开启gzip静态压缩功能 优先使用静态gz文件 gzip_static on; #gzip缓存大小 gzip_buffers 4 16k; #gzip http版本 gzip_http_version 1.1; #gzip 压缩级别 1-10 gzip_comp_level 5; #gzip 压缩类型 gzip_types text/plain application/javascript text/css application/xml text/javascript; # 是否在http header中添加Vary: Accept-Encoding,建议开启 gzip_vary on; server { listen 80; server_name localhost; #charset koi8-r; access_log /var/log/nginx/host.access.log main; error_log /var/log/nginx/error.log error; location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } 然后将需要部署的前端页面全部放入 dist 目录下 ...