标签:sys .repo jpeg access bash com lse 自动构建 nta
Dockerfile 文件构建docker镜像
FROM centos MAINTAINER zh********h.cn RUN rm -f /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf WORKDIR / RUN mkdir data ADD nginx.repo /etc/yum.repos.d RUN yum install nginx -y RUN echo "daemon off;" >> /etc/nginx/nginx.conf RUN rm -rf /etc/nginx/conf.d/default.conf ADD pre.weifeng.conf /etc/nginx/conf.d/ COPY build /data/build RUN useradd -s /sbin/nologin -M www EXPOSE 443 EXPOSE 80 CMD ["nginx"]
nginx 配置文件 cat pre.weifeng.conf server { listen 443; server_name localhost; location / { try_files $uri /index.html; root /data/build; index index.html index.htm; } error_page 404 /404.html; error_page 404 = https://pre.weifeng.cn/index.html; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { access_log off; expires 10d; root /data/build; } location ~ \.(js|css) { access_log off; expires 10d; root /data/build; } } server { listen 80; server_name pre.weifeng.cn; return 301 https://pre.weifeng.cn$request_uri; }
shell 脚本实现jenkins上自动构建阿里云k8s上应用 #!/bin/bash source /etc/profile cd /mnt/workspace/official-ui-pre/ npm i && npm run build rm -rf /mnt/workspace/official-ui-pre/dockerfile/build cd /mnt/workspace/official-ui-pre/dockerfile mv ../build . sudo docker build -t pre-official-ui -f Dockerfile.pre . sudo docker login --username=***** -p ******* registry-vpc.cn-hangzhou.aliyuncs.com sudo docker tag pre-official-ui registry-vpc.cn-hangzhou.aliyuncs.com/weifeng-system/pre-official-ui sudo docker push registry-vpc.cn-hangzhou.aliyuncs.com/weifeng-system/pre-official-ui curl https://cs.console.aliyun.com/hook/trigger?*****************U0pM7Vd60sO3BESRlnjd46F7_wlxcXPKjS8t7k if [ $? -eq 0 ]; then echo -e "\033[32m[ the application official-ui-pre successfully deployed ]\033[0m" else echo -e "\033[31m\033[01m[ the application official-ui-pre deploy failed ]\033[0m" fi
Dockerfile 构建前端nginx应用并用shell脚本实现jenkins自动构建
标签:sys .repo jpeg access bash com lse 自动构建 nta
原文地址:https://www.cnblogs.com/weifeng1463/p/10265760.html