This commit is contained in:
徐聿成 2021-11-15 10:46:26 +08:00
parent 4daac4d9b0
commit bb9a4b6896
3 changed files with 57 additions and 0 deletions

15
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,15 @@
stages:
- deploy
job:
stage: deploy
script:
- docker stop esg_test
- docker rm esg_test
- docker build -t esg_test .
- docker run -d --restart=always --network=host --name esg_test esg_test
only:
- master
tags:
- esg_test

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:10
COPY ./ /app
WORKDIR /app
RUN npm config set registry http://registry.npm.taobao.org
RUN npm install && npm run build
FROM nginx
RUN mkdir /app
COPY --from=0 /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf

31
nginx.conf Normal file
View File

@ -0,0 +1,31 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 44444;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}