mirror of https://gitee.com/pnoker/dc3-web.git
parent
c04255d98c
commit
4474093bbe
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright 2019 Pnoker. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
FROM node:12.14
|
||||
MAINTAINER pnoker pnokers.icloud.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& mkdir -p /dc3-web
|
||||
|
||||
WORKDIR /dc3-web
|
||||
|
||||
ADD ./express ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD [ "node", "./bin/www" ]
|
||||
|
@ -0,0 +1,22 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ./dc3/Dockerfile
|
||||
image: pnoker/dc3-web:3.0
|
||||
restart: always
|
||||
ports:
|
||||
- 3000:3000
|
||||
container_name: dc3.web
|
||||
hostname: dc3.web
|
||||
networks:
|
||||
dc3net:
|
||||
aliases:
|
||||
- dc3.web
|
||||
|
||||
networks:
|
||||
dc3net:
|
||||
driver: 'overlay'
|
||||
...
|
@ -1,31 +1,9 @@
|
||||
const createError = require('http-errors');
|
||||
const express = require('express');
|
||||
const path = require('path');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const logger = require('morgan');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(logger('tiny'));
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({extended: false}));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
next(createError(404));
|
||||
});
|
||||
|
||||
// error handler
|
||||
app.use(function (err, req, res) {
|
||||
// set locals, only providing error in development
|
||||
res.locals.message = err.message;
|
||||
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||
|
||||
// render the error page
|
||||
res.status(err.status || 500);
|
||||
res.render('error');
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
Loading…
Reference in new issue