【问题标题】:Read data from .env file on Dockerfile从 Dockerfile 上的 .env 文件读取数据
【发布时间】:2023-03-03 14:18:01
【问题描述】:

我正在寻找一种通过映像的构建过程从 .env 文件中读取数据的方法,因此选项 docker-compose 不是选项,因为我正在使用 AWS CDK 并且使用“cdk deploy”命令启动构建过程与运行“docker build”命令的方式相同,据我所知,没有这样的选项。

【问题讨论】:

    标签: dockerfile environment-variables


    【解决方案1】:

    我想这会以类似的方式工作。我想对 React 做同样的事情,发现这篇文章很有帮助。那里的 env.sh 文件将与 .env 文件一起复制到您的 Dockerfile 中。

    https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/

    【讨论】:

      猜你喜欢
      • 2020-08-24
      • 1970-01-01
      • 2022-10-09
      • 1970-01-01
      • 1970-01-01
      • 2019-12-30
      • 2021-10-25
      • 1970-01-01
      • 2021-12-12
      相关资源
      最近更新 更多