-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docker): correct language switch path in Docker image
- Loading branch information
1 parent
635490f
commit c5269c9
Showing
4 changed files
with
88 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
# 使用 nodejs 作为基础镜像 | ||
FROM node:lts-alpine | ||
# 第一阶段: 构建静态网站 | ||
FROM node:20-alpine AS builder | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 配置环境 yarn | ||
# RUN npm install -g yarn | ||
|
||
# 复制项目中的 package.json 和 yarn.lock 到工作目录中 | ||
COPY package.json yarn.lock ./ | ||
|
||
# 安装依赖包 | ||
RUN yarn install | ||
# 安装依赖包(仅安装生产环境依赖) | ||
RUN yarn install --frozen-lockfile --production --network-timeout 100000 | ||
|
||
# 复制项目源代码到工作目录 | ||
COPY . . | ||
|
||
# 构建静态站点 | ||
RUN yarn build | ||
|
||
# 使用NGINX作为Web服务器 | ||
# 第二阶段: 使用 Nginx 作为静态服务器 | ||
FROM nginx:stable-alpine | ||
|
||
# 将Docusaurus静态站点文件复制到NGINX默认目录 | ||
COPY --from=0 /app/build /usr/share/nginx/html | ||
# 删除默认的 Nginx 配置文件 | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
# 复制自定义 Nginx 配置文件 | ||
COPY nginx.conf /etc/nginx/conf.d | ||
|
||
# 将第一阶段构建的 Docusaurus 静态站点文件复制到 Nginx 目录 | ||
COPY --from=builder /app/build /usr/share/nginx/html | ||
|
||
# 暴露端口 80 | ||
EXPOSE 80 | ||
# 暴露端口 3000 | ||
EXPOSE 3000 | ||
|
||
# 启动NGINX | ||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
# 容器构建&运行命令 | ||
# docker build -t chatgpt-shortcut . | ||
# docker run -d -p 80:80 --name chatgpt-shortcut chatgpt-shortcut | ||
# docker run -d -p 3000:3000 --name chatgpt-shortcut chatgpt-shortcut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "3.8" | ||
|
||
services: | ||
docsify: | ||
container_name: chatgpt-shortcut | ||
image: ghcr.io/rockbenben/chatgpt-shortcut:latest | ||
ports: | ||
- "3000:3000" | ||
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
server { | ||
listen 3000; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 404 /404.html; | ||
location = /404.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |