feat:🐳 添加打包基础镜像和发布配置
This commit is contained in:
parent
6b195660c7
commit
06003fceab
|
@ -4,3 +4,4 @@ docs/.vuepress/.temp
|
|||
package-lock.json
|
||||
.idea
|
||||
.DS_Store
|
||||
docs/.vuepress/dist
|
|
@ -0,0 +1,10 @@
|
|||
FROM node:18.19.1-alpine3.19 AS build
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 将 package.json 和 package-lock.json 复制到工作目录
|
||||
COPY package.json ./
|
||||
|
||||
# 安装项目依赖
|
||||
RUN npm install
|
|
@ -0,0 +1,20 @@
|
|||
FROM registry.cn-hangzhou.aliyuncs.com/idmesh/base:flow-doc-base-v1 as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
# 构建 React 项目
|
||||
RUN npm run docs:build
|
||||
|
||||
FROM nginx:latest
|
||||
|
||||
# 复制 React 项目构建结果到 Nginx 的默认静态文件目录
|
||||
COPY --from=build /app/docs/.vuepress/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露 Nginx 默认端口
|
||||
EXPOSE 80
|
||||
|
||||
# Nginx 启动命令
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -0,0 +1,61 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flow-doc
|
||||
namespace: ${NAMESPACE}
|
||||
labels:
|
||||
app: flow-doc
|
||||
spec:
|
||||
revisionHistoryLimit: 3
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: flow-doc
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flow-doc
|
||||
annotations:
|
||||
config.linkerd.io/skip-outbound-ports: 3306,16379,6379
|
||||
spec:
|
||||
containers:
|
||||
- name: flow-doc
|
||||
image: ${TAG}
|
||||
imagePullPolicy: IfNotPresent
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
port: 80
|
||||
path: /
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 200Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
env:
|
||||
- name: APP_DEBUG
|
||||
value: "true"
|
||||
- name: LOG_ALLOCATE
|
||||
value: "off"
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- containerPort: 10080
|
||||
imagePullSecrets:
|
||||
- name: docker-registry-public
|
||||
- name: docker-registry-vpc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: flow-doc-service
|
||||
namespace: ${NAMESPACE}
|
||||
labels:
|
||||
app: flow-doc
|
||||
spec:
|
||||
selector:
|
||||
app: flow-doc
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
name: http
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
# https support
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
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 off;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
# server_name localhost;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue