From d4a65f3b76d863349cd1b21b56d060929197a0c2 Mon Sep 17 00:00:00 2001 From: Zachary Date: Thu, 25 Feb 2021 02:16:14 +0800 Subject: [PATCH] update README * add deploy file --- .dockerignore | 2 ++ Dockerfile | 9 +++++++++ README.md | 2 ++ nginx.conf | 30 ++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e0a57b2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +**/node_modules +**/dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f53b37e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:10 +COPY ./ /app +WORKDIR /app +RUN npm install && npm run build + +FROM nginx +RUN mkdir /app +COPY --from=0 /app/dist /app +COPY nginx.conf /etc/nginx/nginx.conf diff --git a/README.md b/README.md index ab7874f..b4127d9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Some components use [element plus](https://github.com/element-plus/element-plus) API using [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) +Deploying with docker + nginx, [Preview address](http://47.100.89.214:8080/MusicLibrary) + ![home](./demo/demo.gif) ## Project setup diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..0a8eca5 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,30 @@ +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 8080; + 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; + } + } +} -- GitLab