From bb9a4b6896fea10553c26fa83bd935ba012b051e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=81=BF=E6=88=90?= Date: Mon, 15 Nov 2021 10:46:26 +0800 Subject: [PATCH] test --- .gitlab-ci.yml | 15 +++++++++++++++ Dockerfile | 11 +++++++++++ nginx.conf | 31 +++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..78787bd --- /dev/null +++ b/.gitlab-ci.yml @@ -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 + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7296204 --- /dev/null +++ b/Dockerfile @@ -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 + \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..a24783c --- /dev/null +++ b/nginx.conf @@ -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; + } + } +} + \ No newline at end of file