build docker

This commit is contained in:
AceDataCloud committed 2022-02-04 16:32:38 +08:00
1 parent 903e7040f0
commit ed255ee070
11 files changed
+54 -94

No files matched your search

+2 -1
View File
@@ -1,7 +1,7 @@
# build stage # build stage
FROM node:lts-alpine as build-stage FROM node:lts-alpine as build-stage
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package.json yarn.lock ./
RUN yarn RUN yarn
COPY . . COPY . .
RUN yarn build RUN yarn build
@@ -9,5 +9,6 @@ RUN yarn build
# production stage # production stage
FROM nginx:stable-alpine as production-stage FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
+9 -7
View File
@@ -2,23 +2,23 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
labels: labels:
app: zhishuyun-frontend app: zhishuyun-auth-frontend
name: zhishuyun-frontend name: zhishuyun-auth-frontend
namespace: zhishuyun namespace: zhishuyun
spec: spec:
replicas: 2 replicas: 2
revisionHistoryLimit: 1 revisionHistoryLimit: 5
selector: selector:
matchLabels: matchLabels:
app: zhishuyun-frontend app: zhishuyun-auth-frontend
template: template:
metadata: metadata:
labels: labels:
app: zhishuyun-frontend app: zhishuyun-auth-frontend
spec: spec:
containers: containers:
- image: zhishuyun/frontend:${TAG} - image: zhishuyun/auth-frontend:${TAG}
name: zhishuyun-frontend name: zhishuyun-auth-frontend
ports: ports:
- containerPort: 80 - containerPort: 80
resources: resources:
@@ -28,4 +28,6 @@ spec:
limits: limits:
memory: '512Mi' memory: '512Mi'
cpu: '200m' cpu: '200m'
imagePullSecrets:
- name: docker-registry
restartPolicy: Always restartPolicy: Always
+5 -5
View File
@@ -1,7 +1,7 @@
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: ingress-zhishuyun-frontend name: ingress-zhishuyun-auth-frontend
namespace: zhishuyun namespace: zhishuyun
annotations: annotations:
kubernetes.io/ingress.class: 'nginx' kubernetes.io/ingress.class: 'nginx'
@@ -10,13 +10,13 @@ metadata:
spec: spec:
tls: tls:
- hosts: - hosts:
- www.zhishuyun.com - auth.zhishuyun.com
secretName: tls-www-zhishuyun-com secretName: tls-auth-zhishuyun-com
rules: rules:
- host: www.zhishuyun.com - host: auth.zhishuyun.com
http: http:
paths: paths:
- backend: - backend:
serviceName: zhishuyun-frontend serviceName: zhishuyun-auth-frontend
servicePort: 8083 servicePort: 8083
path: / path: /
+3 -3
View File
@@ -2,8 +2,8 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
labels: labels:
app: zhishuyun-frontend app: zhishuyun-auth-frontend
name: zhishuyun-frontend name: zhishuyun-auth-frontend
namespace: zhishuyun namespace: zhishuyun
spec: spec:
ports: ports:
@@ -11,4 +11,4 @@ spec:
port: 8083 port: 8083
targetPort: 80 targetPort: 80
selector: selector:
app: zhishuyun-frontend app: zhishuyun-auth-frontend
+8
View File
@@ -0,0 +1,8 @@
version: '3'
services:
zhishuyun-auth-frontend:
container_name: 'zhishuyun-auth-frontend'
build: ./
image: 'ghcr.io/zhishuyun/zhishuyun-auth-frontend:${BUILD_NUMBER}'
ports:
- '8083:80'
+23
View File
@@ -0,0 +1,23 @@
server {
listen 80;
server_name localhost;
location /api/ {
proxy_pass http://zhishuyun-auth-backend:8000/api/;
proxy_http_version 1.1;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "zhishuyun", "name": "zhishuyun-auth",
"version": "0.0.1", "version": "0.1.0",
"scripts": { "scripts": {
"start": "vite --host", "start": "vite --host",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
-52
View File
@@ -1,52 +0,0 @@
<template>
<full-loading
v-model:active="showing"
color="#409eff"
loader="bars"
:opacity="0.8"
:can-cancel="true"
:on-cancel="undefined"
:is-full-page="true"
/>
</template>
<script lang="ts">
import FullLoading from 'vue-loading-overlay';
import 'vue-loading-overlay/dist/vue-loading.css';
import { defineComponent } from 'vue';
export default defineComponent({
name: 'Loading',
components: {
FullLoading
},
data() {
return {
showing: false
};
},
props: {
loading: {
type: Boolean,
default: false
},
delay: {
type: Number,
default: 200
}
},
watch: {
loading: {
handler(val, oldVal) {
if (oldVal === true && val === false) {
setTimeout(() => {
this.showing = val;
}, this.delay);
} else {
this.showing = val;
}
}
}
}
});
</script>
+1 -2
View File
@@ -1,6 +1,5 @@
import TopHeader from './TopHeader.vue'; import TopHeader from './TopHeader.vue';
import Breadcrumb from './Breadcrumb.vue'; import Breadcrumb from './Breadcrumb.vue';
import Loading from './Loading.vue';
import SuccessInfo from './SuccessInfo.vue'; import SuccessInfo from './SuccessInfo.vue';
import Pagination from './Pagination.vue'; import Pagination from './Pagination.vue';
export { TopHeader, Breadcrumb, Loading, SuccessInfo, Pagination }; export { TopHeader, Breadcrumb, SuccessInfo, Pagination };
+1 -2
View File
@@ -1,4 +1,3 @@
import Constants from './constants';
import Methods from './methods'; import Methods from './methods';
export { Constants, Methods }; export { Methods };
-20
View File
@@ -1,20 +0,0 @@
<template>
<div>Home</div>
</template>
<script lang="ts">
import { LayoutHome } from '@/layouts/index';
export default {
components: {
LayoutHome
},
data() {
return {};
},
computed: {},
methods: {}
};
</script>
<style lang="scss"></style>