-
Notifications
You must be signed in to change notification settings - Fork 61.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] 我采用本地build 成镜像后,是否该镜像不会采用.env.local 的配置,我发布上去一直显示需要配置KEY #6341
Comments
Title: [Bug] After I use local build to mirror, will the image not be configured with .env.local? I have been posting it and always show that I need to configure KEY 📦 Deployment methodDocker 📌 Software versionnone 💻 System environmentUbuntu 📌 System version19.2 🌐 BrowserChrome 📌 Browser versionLatest 🐛 Question descriptionI need to put the interface requesting openai into the background project I defined, and configure my own jwt token and my own baseurl in .env.local. It is completely fine to develop debug locally. However, after I build the local docker (which has removed .env.local from docker ignore), and publish it to the external network, the problem of APIKEY not configured is displayed. Do I still need to configure the key directly in the docker file? But I didn't see the baseurl selection, how to configure it? (My backend interface can be adjusted by Postman) 📷 Reproduction stepsNo response 🚦 Expected resultsDocker should start normally after local deployment, and the interface can be adjusted. 📝 Supplementary informationNo response |
不要将任何secrets直接打包进docker镜像,镜像中的文件都是可以被看到的,密钥之类的在运行时传入。 如果你用的是项目自带的打包流程,那么所有的配置项基本都是由环境变量传入的。 |
Do not package any secrets directly into the docker image. The files in the image can be seen, and keys and other files are passed in at runtime. If you are using the package process that comes with the project, then all configuration items are basically passed in by environment variables. |
生产环境默认不会读取.env.local或者.env文件中的配置,请使用环境变量之类的方法进行配置,我知道你在开发环境是生效的。Docker的环境变量配置方法可以看一下文档,docker compose也可以通过.env文件传入,不需要打包进image。 项目的.env和docker compose的.env是不同的东西。遇到不懂的可以先问问AI,这些部分AI回答得比人全面。 |
The production environment will not read the configuration in the .env.local or .env file by default. Please use methods such as environment variables to configure it. I know that your development environment is effective. You can check the documentation for Docker's environment variable configuration method. Docker compose can also be passed in through .env files, and there is no need to package it into image. The project's .env and docker compose .env are different things. If you encounter someone who doesn’t understand, you can ask about AI first. These AI answers are more comprehensive than others. |
📦 部署方式
Docker
📌 软件版本
无
💻 系统环境
Ubuntu
📌 系统版本
19.2
🌐 浏览器
Chrome
📌 浏览器版本
latest
🐛 问题描述
我需要将请求openai 的接口放到自己定义的后台项目,并且在.env.local配置了自己的jwt token,自己的baseurl, 在本地开发debug完全没问题,但是当我本地docker build 后(已经将.env.local 从docker ignore 移除)后,发布到外网,会显示未配置APIKEY的问题。请问我还需要在docker file 直接配置key 么?但是我没看到baseurl 选择,该如何配置?(我的后台接口可以Postman 调通)
📷 复现步骤
No response
🚦 期望结果
docker 本地部署后应该启动正常,可以调通接口。
📝 补充信息
No response
The text was updated successfully, but these errors were encountered: