您现在的位置是:主页 > news > wordpress图片站教程/手机网站免费客服系统
wordpress图片站教程/手机网站免费客服系统
admin2025/5/24 17:08:27【news】
简介wordpress图片站教程,手机网站免费客服系统,安防网站建设,域名解析映射到网站空间怎么做以下项目是个纯vue项目,在项目中加入k8s、nginx、Dockerfile模块 1、配置Dockerfile 将nginx文件下的nginx.conf复制到Nginx配置文件下 并将vue打包后的dist复制到指定目录下 FROM nginx RUN mkdir /usr/share/nginx/dist \&& rm -rf /etc/nginx/nginx.…
wordpress图片站教程,手机网站免费客服系统,安防网站建设,域名解析映射到网站空间怎么做以下项目是个纯vue项目,在项目中加入k8s、nginx、Dockerfile模块
1、配置Dockerfile
将nginx文件下的nginx.conf复制到Nginx配置文件下 并将vue打包后的dist复制到指定目录下
FROM nginx
RUN mkdir /usr/share/nginx/dist \&& rm -rf /etc/nginx/nginx.…
以下项目是个纯vue项目,在项目中加入k8s、nginx、Dockerfile模块
1、配置Dockerfile
将nginx文件下的nginx.conf复制到Nginx配置文件下
并将vue打包后的dist复制到指定目录下
FROM nginx
RUN mkdir /usr/share/nginx/dist \&& rm -rf /etc/nginx/nginx.conf \&& /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./dist/ /usr/share/nginx/dist
EXPOSE 8080
2、配置k8s
如果不需要推送到k8s,这一步可以省略不要
deployment.json
namespace要换成自己的k8s命名空间
{"kind": "Deployment","apiVersion": "apps/v1","metadata": {"name": "${APP_NAME}-deployment","namespace": "自己的命名空间","labels": {"k8s-app": "${APP_NAME}"}},"spec": {"replicas": 1,"selector": {"matchLabels": {"k8s-app": "${APP_NAME}"}},"template": {"metadata": {"name": "${APP_NAME}","labels": {"k8s-app": "${APP_NAME}"}},"spec": {"containers": [{"name": "app","image": "hfdockerhub.com.cc:1443/hfocean/jenkins-${APP_NAME}:${BUILD_NUMBER}","resources": {},"imagePullPolicy": "IfNotPresent","securityContext": {"privileged": false,"procMount": "Default"},"ports":[{ "containerPort": 8080, "targetPort": 8080}],"volumeMounts":[]}],"volumes":[],"type": "NodePort","restartPolicy": "Always","terminationGracePeriodSeconds": 30,"dnsPolicy": "ClusterFirst","securityContext": {},"schedulerName": "default-scheduler"}},"strategy": {"type": "RollingUpdate","rollingUpdate": {"maxUnavailable": "25%","maxSurge": "25%"}},"revisionHistoryLimit": 10,"progressDeadlineSeconds": 600}
}
service.json
namespace要换成自己的k8s命名空间
{"apiVersion":"v1","kind":"Service","metadata":{"namespace":"自己的命名空间","name":"${APP_NAME}-service","labels":{"k8s-service":"${APP_NAME}"}},"spec":{"selector":{"k8s-app": "${APP_NAME}"},"ports":[{"name": "web","protocol": "TCP","port":8080,"targetPort":8080}],"type":"NodePort"}
}
3、配置nginx
nginx.conf
worker_processes 1;events {worker_connections 1024;
}
http {sendfile on;tcp_nodelay on;keepalive_timeout 30;# 开启gzipgzip on;gzip_static on; #开启gzip_vary on;gzip_proxied any;# gzip_http_version 1.1;# gzip_disable "MSIE [1-6]\.";# gzip_vary on;# gzip_proxied expired no-cache no-store private auth;# gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript;include /etc/nginx/mime.types;default_type application/octet-stream;server {listen 8080;server_name localhost;root /usr/share/nginx/dist;autoindex on;autoindex_exact_size off;autoindex_localtime on;location / {try_files $uri $uri/ @router;index index.html index.htm;}location @router {rewrite ^.*$ /index.html last;}}
}
4、配置jekins
开始配置svn
配置APP_NAME
开始配置node.js
推送k8s (如果不需要推送k8s,这一步可以省略)
docker build -t hfdockerhub.com.cc:1443/hfocean/jenkins-${APP_NAME}:${BUILD_NUMBER} .
docker push hfdockerhub.com.cc:1443/hfocean/jenkins-${APP_NAME}:${BUILD_NUMBER}
5、运行jekins
6、打开k8s管理平台查看
我们进入部署的项目中