作者 曾海沥

add dev

FROM centos:centos7
MAINTAINER The CentOS Project <cloud-ops@centos.org>
RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install nginx; yum clean all
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
#RUN echo "nginx on CentOS 7 inside Docker" > /usr/share/nginx/html/index.html
COPY ./conf.d /etc/nginx/conf.d
COPY ./dist /home/project
EXPOSE 80
CMD [ "/usr/sbin/nginx" ]
... ...
server {
listen 80;
server_name suplus-yhs-dev.fjmaimaimai.com;
gzip_static on;
root /home/project;
index index.html;
location /flow-platform-api/ {
proxy_pass http://suplus-customer/;
}
}
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
if [ "$?" == "1" ];then
kubectl create -f /tmp/suplus-front.yaml --record
kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
if [ "$?" == "0" ];then
echo "suplus-front service install success!"
else
echo "suplus-front service install fail!"
fi
kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
if [ "$?" == "0" ];then
echo "suplus-front deployment install success!"
else
echo "suplus-front deployment install fail!"
fi
else
kubectl delete -f /tmp/suplus-front.yaml
kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
done
kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
done
kubectl create -f /tmp/suplus-front.yaml --record
kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
if [ "$?" == "0" ];then
echo "suplus-front service update success!"
else
echo "suplus-front service update fail!"
fi
kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
if [ "$?" == "0" ];then
echo "suplus-front deployment update success!"
else
echo "suplus-front deployment update fail!"
fi
fi
\ No newline at end of file
... ...
apiVersion: v1
kind: Service
metadata:
name: suplus-front
namespace: mmm-suplus-dev
labels:
k8s-app: suplus-front
spec:
ports:
- name: "http"
port: 80
targetPort: 80
selector:
k8s-app: suplus-front
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: suplus-front
namespace: mmm-suplus-dev
labels:
k8s-app: suplus-front
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: suplus-front
spec:
containers:
- name: suplus-front
image: 192.168.0.243:5000/mmm/suplus-front:dev
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
ports:
- containerPort: 80
env:
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.port
- name: MYSQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.user
- name: MYSQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "suplus_file"
- name: aliyun_logs_suplusfront
value: "stdout"
- name: aliyun_logs_access
value: " /opt/logs/app.log"
volumes:
- name: accesslogs
emptyDir: {}
... ...