Skip to content

Commit

Permalink
chore: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed Mar 30, 2023
1 parent 24b1797 commit 570dc8b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
COPY . .
ARG OPENAI_API_KEY
RUN if [ -n "$OPENAI_API_KEY" ]; then \
echo -e "\nOPENAI_API_KEY=\"$OPENAI_API_KEY\"\n" >> /usr/src/.env; \
fi
ARG HTTPS_PROXY
RUN if [ -n "$HTTPS_PROXY" ]; then \
echo -e "\nHTTPS_PROXY=\"$HTTPS_PROXY\"\n" >> /usr/src/.env; \
fi
ARG OPENAI_API_BASE_URL
RUN if [ -n "$OPENAI_API_BASE_URL" ]; then \
echo -e "\nOPENAI_API_BASE_URL=\"$OPENAI_API_BASE_URL\"\n" >> /usr/src/.env; \
fi
ARG HEAD_SCRIPTS
RUN if [ -n "$HEAD_SCRIPTS" ]; then \
echo -e "\nHEAD_SCRIPTS=\"$HEAD_SCRIPTS\"\n" >> /usr/src/.env; \
fi
ARG SECRET_KEY
RUN if [ -n "$SECRET_KEY" ]; then \
echo -e "\nSECRET_KEY=\"$SECRET_KEY\"\n" >> /usr/src/.env; \
fi
ARG SITE_PASSWORD
RUN if [ -n "$SITE_PASSWORD" ]; then \
echo -e "\nSITE_PASSWORD=\"$SITE_PASSWORD\"\n" >> /usr/src/.env; \
fi
ARG OPENAI_API_MODEL
RUN if [ -n "$OPENAI_API_MODEL" ]; then \
echo -e "\nOPENAI_API_MODEL=\"$OPENAI_API_MODEL\"\n" >> /usr/src/.env; \
fi
RUN pnpm run build
ENV HOST=0.0.0.0 PORT=3000 NODE_ENV=production
EXPOSE $PORT
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ A demo repo based on [OpenAI GPT-3.5 Turbo API.](https://platform.openai.com/doc

### Deploy with Docker

Before deploying the app, please make sure `.env` is configured normally.

Environment variables refer to the documentation below. [Docker Hub address](https://hub.docker.com/r/ddiu8081/chatgpt-demo).

**Direct run**
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230310/image.e0n7c0zaen4.webp)

### 部署在 Docker
环境变量参考下方文档, [Docker Hub address](https://hub.docker.com/r/ddiu8081/chatgpt-demo).
部署之前请确认 `.env` 文件正常配置,环境变量参考下方文档, [Docker Hub address](https://hub.docker.com/r/ddiu8081/chatgpt-demo).

**一键运行**
```bash
Expand Down

1 comment on commit 570dc8b

@vercel
Copy link

@vercel vercel bot commented on 570dc8b Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.