jenkins docker 部署 前端
标签搜索
侧边栏壁纸
博主昵称
2c

  • 累计撰写 19 篇文章
  • 累计收到 12 条评论

jenkins docker 部署 前端

2c
2c
2022-10-25 / 0 评论 / 4 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年10月31日,已超过543天没有更新,若内容或图片失效,请留言反馈。

搭建好Jenkins 下载插件 Publish Over SSH Node Docker
l9nw8lxv.png
文件格式
Dockerfile

FROM nginx:1.17.0-alpine

LABEL maintainer = 1054711110@qq.com

COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d
COPY src /usr/share/nginx/html

docker-compose.yaml

version: '3'
services:
  # 前端
  service-front:
    hostname: service-front
    container_name: service-front
    image: registry.cn-hangzhou.aliyuncs.com/lazycat520/moka-frontend:V-NUMBER
    restart: always
    ports:
      - "81:80"
    volumes:
      - /etc/timezone:/etc/timezone
      - /etc/localtime:/etc/localtime

nginx/default.conf

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        # try_files $uri $uri/ /index.html;
    }

    #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;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

nginx/nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    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;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    #gzip_http_version 1.0;
    gzip_comp_level 8;
    gzip_types application/json application/octet-stream text/plain application/javascript application/css text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";

    include /etc/nginx/conf.d/*.conf;
}

jenkins

l9nwh5ia.png

节点配置

l9nwith8.png

阿里镜像

l9nwk4v9.png

registry.cn-hangzhou.aliyuncs.com/lazycat520/moka-frontend:V${BUILD_NUMBER}

l9nwko2v.png

sed -i 's/V-NUMBER/V${BUILD_NUMBER}/g' docker-compose.yaml && docker-compose up -d
0

评论 (0)

取消