diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..99c049b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx +COPY unpackage/dist/build/h5 /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/deploy.yaml b/deploy.yaml new file mode 100644 index 0000000..81bd20c --- /dev/null +++ b/deploy.yaml @@ -0,0 +1,54 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + labels: + app: $IMAGES + name: $IMAGES + namespace: yanxuan +spec: + progressDeadlineSeconds: 600 + replicas: 1 + selector: + matchLabels: + app: $IMAGES + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 25% + maxSurge: 25% + template: + metadata: + labels: + app: $IMAGES + spec: + imagePullSecrets: + - name: aliyun-docker-hub + containers: + - image: '$REGISTRY/$DOCKERHUB_NAMESPACE/$IMAGES:$BUILD_NUMBER' + name: app + ports: + - containerPort: $JAR_PORD + protocol: TCP + resources: + limits: + cpu: '0.5' + memory: 500Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + terminationGracePeriodSeconds: 30 +--- +kind: Service +apiVersion: v1 +metadata: + name: $IMAGES + namespace: yanxuan +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 80 + selector: + app: $IMAGES + type: ClusterIP diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..64b8037 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + listen [::]:80; + server_name localhost default_server; + client_max_body_size 200m; + + location / { + if ($request_filename ~* .*\.(?:htm|html)$) { + add_header Cache-Control "no-store"; + } + root /usr/share/nginx/html; + try_files $uri @index ; + } + + + + + location @index { + add_header Cache-Control "no-store" ; + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri/index.html /index.html; + } + + error_page 405 =200 $uri; +}