作者 曾海沥

add all

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" ]
\ No newline at end of file
... ...
server {
listen 80;
server_name suplus-front-dev.fjmaimaimai.com;
gzip_static on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
root /home/project;
index index.html;
location /flow-platform-api/ {
proxy_pass http://suplus-customer/;
}
}
... ...
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
... ...
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
... ...
'use strict'
module.exports = {
NODE_ENV: '"production"'
}
... ...
#!/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: {}
... ...