Authored by 陈峰

commit

// 将设置放入此文件中以覆盖默认值和用户设置。
{
"files.exclude": {
"public/dist/": true,
"logs/": true
},
"vetur.grammar.customBlocks": {
... ...
... ... @@ -6,26 +6,23 @@
# nginx version: 1.12.0
############################################################
#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
FROM ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
#base image : ccr.ccs.tencentyun.com/yoho-base/node
FROM ccr.ccs.tencentyun.com/yoho-base/node:10.4.1-alpine-fix
MAINTAINER feng.chen <feng.chen@yoho.cn>
ENV NODE_ENV=production \
NODE_HOME=/home
COPY yoho-blk-wap.tar.gz /home
RUN cd /home && \
mkdir -p /home/yoho-blk-wap && \
mkdir -p /Data/log/yoho-blk-wap && \
mkdir -p /Data/log/yohoblk-wap && \
tar -xzvf yoho-blk-wap.tar.gz -C /home/yoho-blk-wap && \
rm -rf yoho-blk-wap.tar.gz
mkdir -p /Data/log/yoho-blk-wap
COPY . /home/yoho-blk-wap
WORKDIR /home/yoho-blk-wap
#expose port
EXPOSE 6004
CMD ["node","/home/yoho-blk-wap/app.js"]
EXPOSE 6002
CMD ["node","/home/yoho-blk-wap/app.js"]
\ No newline at end of file
... ...
const shelljs = require('shelljs');
const path = require('path');
const distDir = path.join(__dirname, '../dist/node');
shelljs.rm('-rf', distDir);
shelljs.mkdir('-p', distDir);
const cpPaths = [
'favicon.ico',
'.npmrc',
'process.json',
'Dockerfile',
'yarn.lock',
'package.json',
'*.js',
'config',
'apps',
'utils',
'doraemon',
'src/index.html',
'manifest.json'
];
new Promise(resolve => { // 加载manifest.json文件
resolve();
}).then(() => { // 拷贝node代码
cpPaths.forEach(p => {
let dist = distDir;
let file = p;
if (typeof p === 'object') {
dist = path.join(dist, p[1]);
file = p[0];
if (!shelljs.test('-e', dist)) {
shelljs.mkdir('-p', dist);
}
}
shelljs.cp('-R', path.join(__dirname, '../', file), dist);
});
}).then(() => { // 安装依赖和清理node_modules
shelljs.cd(distDir);
if (shelljs.exec('yarn --production=true').code !== 0) {
throw 'yarn install faild';
}
}).catch(error => {
console.error(`error:${error}`);
return process.exit(1); //eslint-disable-line
});
... ...
... ... @@ -2,7 +2,7 @@ const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const pkg = require('../package.json');
const distDir = path.join(__dirname, `../public/dist/${pkg.name}/bundle`);
const distDir = path.join(__dirname, `../dist/${pkg.name}/bundle`);
module.exports = {
output: {
... ...
... ... @@ -57,7 +57,7 @@ exports.createApp = async (app) => {
res.status(200).end();
});
app.use(favicon(path.join(__dirname, '/public/favicon.ico')));
app.use(favicon(path.join(__dirname, '/favicon.ico')));
app.use(express.static(path.join(__dirname, 'public')));
// 添加请求上下文
... ...
#!/bin/bash
wordir=$2
needBuild=$1
cd $wordir
rm -rf yoho-blk-wap.tar.gz
yarn
if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]]
then
yarn build
yarn --production=false
if [ "$needBuild" == "YES" ];then
yarn build
fi
tar -czvf yoho-blk-wap.tar.gz *
yarn build:node --build=$needBuild
/usr/local/bin/node-prune ./dist/node/node_modules
... ...
... ... @@ -44,7 +44,7 @@ const routes = [
const isDev = process.env.NODE_ENV === 'development' || !process.env.NODE_ENV;
let renderer;
let template = fs.readFileSync(path.join(__dirname, '../../src/index.html'), 'utf-8');
let template = fs.readFileSync(path.join(__dirname, '../../index.html'), 'utf-8');
const microCache = LRU({ // eslint-disable-line
max: 1000,
... ...
No preview for this file type
{}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,7 @@
"server": "NODE_ENV=production webpack --config ./build/webpack.server.conf.js",
"static": "webpack-dev-server --config ./public/build/webpack.dev.config.js",
"build": "NODE_ENV=production webpack --config ./public/build/webpack.prod.config.js && node ./build/build.js",
"build:node": "node ./build/node-build.js",
"performance": "NODE_ENV=performance webpack --config ./public/build/webpack.prod.config.js",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
... ...
... ... @@ -5,7 +5,7 @@ const UglifyJsParallelPlugin = require('webpack-uglify-parallel');
const os = require('os');
const pkg = require('../../package.json');
const path = require('path');
const distDir = path.join(__dirname, `../dist/${pkg.name}`);
const distDir = path.join(__dirname, `../../dist/${pkg.name}`);
let base = require('./webpack.base.config');
... ...