commit
14aa7e3112
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
58
.onedev-buildspec.yml
Normal file
58
.onedev-buildspec.yml
Normal file
@ -0,0 +1,58 @@
|
||||
version: 18
|
||||
jobs:
|
||||
- name: vue ci
|
||||
steps:
|
||||
- !CheckoutStep
|
||||
name: checkout
|
||||
cloneCredential: !DefaultCredential {}
|
||||
withLfs: false
|
||||
withSubmodules: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !SetBuildVersionStep
|
||||
name: set build version
|
||||
buildVersion: '@script:builtin:node:determine-project-version@'
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !CommandStep
|
||||
name: build & test
|
||||
runInContainer: true
|
||||
image: node:16.17.0-alpine
|
||||
interpreter: !DefaultInterpreter
|
||||
commands:
|
||||
- yarn --registry=https://registry.npm.taobao.org
|
||||
- npx nuxt build
|
||||
useTTY: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
triggers:
|
||||
- !BranchUpdateTrigger {}
|
||||
retryCondition: never
|
||||
maxRetries: 3
|
||||
retryDelay: 30
|
||||
cpuRequirement: 250
|
||||
memoryRequirement: 256
|
||||
caches:
|
||||
- key: npm-cache
|
||||
path: /root/.npm
|
||||
timeout: 3600
|
||||
- name: Build Docker Image
|
||||
jobExecutor: internal
|
||||
steps:
|
||||
- !CheckoutStep
|
||||
name: Checkout Code
|
||||
cloneCredential: !DefaultCredential {}
|
||||
withLfs: false
|
||||
withSubmodules: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !BuildImageStep
|
||||
name: Build Docker Image
|
||||
tags: rymcu/nebula:latest
|
||||
publish: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
triggers:
|
||||
- !TagCreateTrigger
|
||||
projects: nebula
|
||||
retryCondition: never
|
||||
maxRetries: 3
|
||||
retryDelay: 30
|
||||
cpuRequirement: 250
|
||||
memoryRequirement: 256
|
||||
timeout: 3600
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM node:16.17.0-alpine
|
||||
|
||||
#创建/opt/app 目录作为部署目录,创建容器实例时,挂载此目录
|
||||
RUN mkdir -p /opt/app
|
||||
# 设置工作目录
|
||||
WORKDIR /opt/app
|
||||
|
||||
# 将代码复制到容器中
|
||||
COPY . /opt/app
|
||||
|
||||
RUN cd /opt/app
|
||||
# 添加权限,防止依赖无法安装
|
||||
RUN chmod -R 777 *
|
||||
# 添加执行shell文件权限
|
||||
RUN chmod u+x pm2.sh
|
||||
RUN yarn --registry=https://registry.npm.taobao.org
|
||||
RUN npm i pm2 -g --registry=https://registry.npm.taobao.org
|
||||
RUN npm run build
|
||||
|
||||
RUN ls -l -a
|
||||
|
||||
# 容器对外暴露的端口号,要和node项目配置的端口号一致
|
||||
EXPOSE 3000
|
||||
# 修复容器外无法访问问题
|
||||
ENV NUXT_HOST=0.0.0.0
|
||||
ENV NUXT_PORT=3000
|
||||
|
||||
# 通过shell文件来执行多条命令
|
||||
CMD ["./pm2.sh"]
|
@ -94,6 +94,7 @@ nebula([ˈnebyələ],n.星云)是一款现代化的知识社区项目,
|
||||
|
||||
|
||||
![JetBrains](assets/jb_beam.svg)
|
||||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fnebula.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fnebula?ref=badge_shield)
|
||||
|
||||
## Build Setup
|
||||
|
||||
@ -126,3 +127,7 @@ $ npm generate
|
||||
|
||||
|
||||
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
|
||||
|
||||
|
||||
## License
|
||||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fnebula.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fnebula?ref=badge_large)
|
@ -4,7 +4,7 @@
|
||||
<header-view/>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<nuxt :nuxt-child-key="$route.name"/>
|
||||
<nuxt :nuxt-child-key="$route.name" keep-alive :keep-alive-props="{max: 16}"/>
|
||||
</el-main>
|
||||
<el-footer height="5rem">
|
||||
<footer-view/>
|
||||
|
@ -11,6 +11,16 @@ const apisMap = {
|
||||
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
|
||||
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
|
||||
},
|
||||
test: {
|
||||
FE: 'https://test.rymcu.com',
|
||||
BASE: 'https://test.rymcu.com',
|
||||
CDN: 'https://static.rymcu.com',
|
||||
PROXY: 'https://static.rymcu.com/proxy',
|
||||
SOCKET: 'https://test.rymcu.com/wss',
|
||||
GRAVATAR: 'https://static.rymcu.com/avatar',
|
||||
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
|
||||
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
|
||||
},
|
||||
production: {
|
||||
FE: 'https://rymcu.com',
|
||||
BASE: 'https://rymcu.com',
|
||||
|
@ -110,7 +110,8 @@ export default {
|
||||
components: {
|
||||
EditTags
|
||||
},
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('admin/fetchArticles', params)
|
||||
|
@ -76,7 +76,8 @@ import Records from "../../components/common/bank/account/records";
|
||||
export default {
|
||||
name: "bank-accounts",
|
||||
components: {Records},
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('bank-account/fetchList', params)
|
||||
|
@ -87,7 +87,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "banks",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('bank/fetchList', params)
|
||||
|
@ -97,7 +97,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "comments",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('admin/fetchComments', params)
|
||||
|
@ -81,7 +81,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "currency-rules",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('currency-rule/fetchList', params)
|
||||
|
@ -251,7 +251,8 @@ export default {
|
||||
components: {
|
||||
EditTags
|
||||
},
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('dashboard/fetchDashboard', params)
|
||||
|
@ -80,7 +80,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "products",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('admin/fetchProducts', params)
|
||||
|
@ -91,7 +91,8 @@
|
||||
|
||||
export default {
|
||||
name: "roles",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('admin/fetchRoles', params)
|
||||
|
@ -48,7 +48,8 @@
|
||||
|
||||
export default {
|
||||
name: "tags",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('tag/fetchList', params)
|
||||
|
@ -77,7 +77,8 @@ export default {
|
||||
}
|
||||
return params.topic_uri
|
||||
},
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store.dispatch('topic/fetchDetail', params)
|
||||
.catch(err => error({statusCode: 404})),
|
||||
|
@ -39,7 +39,8 @@
|
||||
|
||||
export default {
|
||||
name: "topics",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('topic/fetchList', params)
|
||||
|
@ -119,7 +119,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "users",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('admin/fetchUsers', params)
|
||||
|
@ -16,7 +16,8 @@
|
||||
components: {
|
||||
DraftList
|
||||
},
|
||||
fetch({store, error}) {
|
||||
fetch() {
|
||||
let {store, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('draft/fetchList')
|
||||
|
@ -11,7 +11,8 @@ import {mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
fetch({store, query}) {
|
||||
fetch() {
|
||||
let {store, query, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store.dispatch('article/fetchList', {page: query.page || 1}),
|
||||
store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})
|
||||
|
@ -17,7 +17,8 @@
|
||||
components: {
|
||||
NotificationList
|
||||
},
|
||||
fetch({store, query, error}) {
|
||||
fetch() {
|
||||
let {store, query, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('notification/fetchList', {page: query.page || 1})
|
||||
|
@ -54,7 +54,8 @@ import gzh from "assets/rymcugzh.jpg";
|
||||
Vue.prototype.$echarts = echarts;
|
||||
export default {
|
||||
name: "openData",
|
||||
fetch({store, params, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('open-data/fetchLastThirtyDays', params)
|
||||
|
@ -16,7 +16,8 @@ import PortfolioList from "~/components/common/portfolio/list";
|
||||
export default {
|
||||
name: "Portfolios",
|
||||
components: {PortfolioList},
|
||||
fetch({store, query, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('portfolio/fetchList', {page: query.page || 1})
|
||||
|
@ -13,7 +13,8 @@ import ProductList from "~/components/common/product/list";
|
||||
export default {
|
||||
name: "products",
|
||||
components: {ProductList},
|
||||
fetch({store, query, error}) {
|
||||
fetch() {
|
||||
let {store, params, error} = this.$nuxt.context
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('product/fetchList', {page: query.page || 1})
|
||||
|
19
pm2.json
Normal file
19
pm2.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "nebula",
|
||||
"exec_mode": "cluster",
|
||||
"instances": "max",
|
||||
"script": "./node_modules/nuxt/bin/nuxt.js",
|
||||
"args": "start",
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"env_test": {
|
||||
"NODE_ENV": "test"
|
||||
},
|
||||
"env_dev": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"env_prod": {
|
||||
"NODE_ENV": "production"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user