From f7a3e019a54ee1d096c98217afd35b9cfc9d30a4 Mon Sep 17 00:00:00 2001 From: cloudGrin Date: Fri, 10 Mar 2023 14:33:36 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=AE=80=E5=8C=96docker-compose?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=20(#466)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose/docker-compose.yml | 6 +++--- docker-compose/nginx/Dockerfile | 10 ---------- docker-compose/nginx/nginx.conf | 6 +++--- docker-compose/readme.md | 3 +-- 4 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 docker-compose/nginx/Dockerfile diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 34ca3b162c..f6082eddb4 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -25,13 +25,13 @@ services: # Socks代理端口,可选,和 SOCKS_PROXY_HOST 一起时生效 SOCKS_PROXY_PORT: xxxx nginx: - build: nginx - image: chatgpt/nginx + image: nginx:alpine ports: - '80:80' expose: - '80' volumes: - - ./nginx/html/:/etc/nginx/html/ + - ./nginx/html:/usr/share/nginx/html + - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf links: - app diff --git a/docker-compose/nginx/Dockerfile b/docker-compose/nginx/Dockerfile deleted file mode 100644 index 387c3d8e2c..0000000000 --- a/docker-compose/nginx/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM hub.c.163.com/library/nginx - -MAINTAINER jo "tionsin@live.com" - -RUN rm -rf /etc/nginx/conf.d/default.conf -COPY ./nginx.conf /etc/nginx/conf.d/default.conf -COPY ./html/ /usr/share/nginx/html/ -EXPOSE 80 - -CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose/nginx/nginx.conf b/docker-compose/nginx/nginx.conf index eebdc81626..0f9df35798 100644 --- a/docker-compose/nginx/nginx.conf +++ b/docker-compose/nginx/nginx.conf @@ -3,9 +3,9 @@ server { server_name localhost; charset utf-8; error_page 500 502 503 504 /50x.html; - location = / { - root /usr/share/nginx/html; - index index.html index.htm; + location / { + root /usr/share/nginx/html; + try_files $uri /index.html; } location /api { diff --git a/docker-compose/readme.md b/docker-compose/readme.md index b1131a09cf..9af7e0a0db 100644 --- a/docker-compose/readme.md +++ b/docker-compose/readme.md @@ -1,8 +1,7 @@ ### docker-compose 部署教程 - 将打包好的前端文件放到 `nginx/html` 目录下 - ```shell - # 打包启动 - docker-compose build + # 启动 docker-compose up -d ``` - ```shell