Commit 9180864e authored by 卢浩元's avatar 卢浩元

init

parents
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
FROM nginx:alpine
COPY dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
#!/usr/bin/env groovy
def projectProperties = [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '5']],
parameters([
string(name: 'DOCKER_USER', defaultValue: '', description: 'docker用户名'),
string(name: 'DOCKER_PASSWORD', defaultValue: '', description: 'docker用户密码'),
string(name: 'REGISTRY_URL', defaultValue: 'docker.io', description: 'docker仓库地址')
])
]
properties(projectProperties)
podTemplate(cloud: 'kubernetes', containers: [
containerTemplate(name: 'nodejs', image: 'node:10-alpine', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.14.0', command: 'cat', ttyEnabled: true)
],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'),
hostPathVolume(hostPath: '/root/.kube', mountPath: '/root/.kube'),
]
) {
// POD_LABEL是kubernetes插件1.17.0版本之后的一个新特性
// 将会根据流水线名称和构建序号自动生成
node(POD_LABEL) {
container('nodejs') {
stage('checkout') {
checkout scm
sh 'printenv'
}
stage('init') {
sh "npm config set registry https://registry.npm.taobao.org"
}
stage('compile') {
sh 'npm install'
sh 'npm run build:prod'
}
}
container('docker') {
stage('docker-login') {
//REGISTRY_URL私有仓库地址,也可使用官方地址:docker.io
sh "docker login -u ${params.DOCKER_USER} -p ${params.DOCKER_PASSWORD} ${params.REGISTRY_URL}"
}
stage('docker-build') {
sh "docker build . -t ${params.REGISTRY_URL}/lusyoe/vue-example:${env.BUILD_ID}"
}
stage('docker-push') {
sh "docker push ${params.REGISTRY_URL}/lusyoe/vue-example:${env.BUILD_ID}"
}
stage('docker-remove') {
sh "docker rmi ${params.REGISTRY_URL}/lusyoe/vue-example:${env.BUILD_ID}"
}
}
container('kubectl') {
stage('k8s deploy') {
sh "sed -i \"s/lusyoe\\/k8s-example/${params.REGISTRY_URL}\\/lusyoe\\/k8s-example:${env.BUILD_ID}/g\" k8s-example.yaml"
sh "kubectl --kubeconfig=/root/.kube/config apply -f k8s-example.yaml"
}
}
}
}
// vim: ft=groovy
# luhy-vue-demo
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
module.exports = {
presets: [
'@vue/app'
]
}
apiVersion: apps/v1
kind: Deployment
metadata:
name: k8s-example
labels:
app: k8s-example
tier: front
spec:
replicas: 1
selector:
matchLabels:
app: k8s-example
tier: front
template:
metadata:
labels:
app: k8s-example
tier: front
spec:
containers:
- name: k8s-example
image: lusyoe/k8s-example
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 15
---
apiVersion: v1
kind: Service
metadata:
name: k8s-example
labels:
app: k8s-example
tier: front
spec:
selector:
app: k8s-example
tier: front
ports:
- port: 80
name: k8s-front
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: k8s-example
spec:
rules:
- host: vue.k8s-example.com
http:
paths:
- front:
serviceName: k8s-example
servicePort: k8s-front
This diff is collapsed.
{
"name": "luhy-vue-demo",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^2.5.17"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.4",
"@vue/cli-plugin-eslint": "^3.0.4",
"@vue/cli-service": "^3.0.4",
"vue-template-compiler": "^2.5.17"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>luhy-vue-demo</title>
<meta base="/luhy-vue-demo/">
</head>
<body>
<noscript>
<strong>We're sorry but luhy-vue-demo doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome"/>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'app',
components: {
HelloWorld
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment