feat: docker 部署

test
bigfengyu 5 years ago
parent e6f56e4771
commit d9e362993a

@ -0,0 +1,19 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage
# misc
.DS_Store
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# css
src/**/*.css
build
build.zip

@ -0,0 +1,22 @@
# BUILDING
FROM node:lts-alpine AS builder
WORKDIR /app
COPY . ./
COPY docker/config.prod.ts ./src/config/config.prod.ts
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
g++ && \
yarn config set registry https://registry.npm.taobao.org/ && \
yarn install && \
apk del build-dependencies && \
yarn global add typescript && \
yarn run lint && \
SERVE_URL=http://localhost:8080 yarn run build
# nginx
FROM nginx:stable-alpine
COPY --from=builder app/build /dolores
RUN rm /etc/nginx/conf.d/default.conf
COPY docker/nginx.conf /etc/nginx/conf.d/

@ -0,0 +1,9 @@
const config: IConfig = {
serve: 'http://localhost:38080',
keys: ['some secret hurr'],
session: {
key: 'koa:sess',
},
}
export default config

@ -0,0 +1,10 @@
server {
listen 38081;
server_name localhost;
root /dolores;
location / {
try_files $uri /index.html;
}
}

@ -13,7 +13,8 @@
"test-backup": "npm run lint && react-scripts test --env=jsdom",
"test": "npm run lint",
"eject": "react-scripts eject",
"lint": "tslint --project ./ -c tslint.json"
"lint": "tslint --project ./ -c tslint.json",
"build:docker": "docker build --rm -f \"Dockerfile\" -t rapteam/rap2-dolores:latest ."
},
"repository": {
"type": "git",
@ -104,7 +105,7 @@
"@types/sortablejs": "^1.7.2",
"@types/urijs": "^1.19.3",
"@types/yup": "^0.26.21",
"node-sass": "4.12.0",
"node-sass": "4.13.0",
"npm-run-all": "4.1.5",
"pre-commit": "^1.2.2",
"react-scripts": "^3.0.1",

Loading…
Cancel
Save