diff --git a/Makefile b/Makefile index 1289499..57fee97 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,11 @@ deploy: manifests kubectl apply -f config/deploy # Build the frontend docker image -docker-build-frontend: test +docker-build-frontend: docker build . -f ${DOCKERFILE_FRONTEND} -t ${IMG_FRONTEND}:${TAG} # Build the backend docker image -docker-build-backend: test +docker-build-backend: docker build . -f ${DOCKERFILE_BACKEND} -t ${IMG_BACKEND}:${TAG} # Push the docker image diff --git a/config/deploy/kubediag-dashboard-deployment.yaml b/config/deploy/kubediag-dashboard-deployment.yaml index b064be6..ee747aa 100644 --- a/config/deploy/kubediag-dashboard-deployment.yaml +++ b/config/deploy/kubediag-dashboard-deployment.yaml @@ -1,3 +1,34 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf +data: + nginx.conf: | + server { + listen 8080; + server_name localhost; + + location /api/ { + proxy_pass http://localhost:7000/api/; + } + + // location with routePrefix + location /kubediag/${routePrefix}/api/ { + proxy_pass http://localhost:7000/api/; + } + + // location with routePrefix + location /kubediag/${routePrefix}/ { + proxy_pass http://localhost:8080/; + } + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + } +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -16,12 +47,24 @@ spec: spec: containers: - name: backend - image: hub.c.163.com/kubediag/kubediag-dashboard-backend:v0.1.0 + image: hub.c.163.com/kubediag/kubediag-dashboard-backend:v0.1.1 imagePullPolicy: IfNotPresent ports: - containerPort: 7000 - name: frontend - image: hub.c.163.com/kubediag/kubediag-dashboard-frontend:v0.1.0 + image: hub.c.163.com/kubediag/kubediag-dashboard-frontend:v0.1.1 imagePullPolicy: IfNotPresent ports: - containerPort: 8080 + volumeMounts: + - name: nginx-conf + mountPath: /etc/nginx/conf.d/default.conf + subPath: nginx.conf + readOnly: true + volumes: + - name: nginx-conf + configMap: + name: nginx-conf + items: + - key: nginx.conf + path: nginx.conf