Skip to content
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

不要把帳號密碼放在 source code #3

Closed
RammusXu opened this issue Jul 23, 2018 · 3 comments
Closed

不要把帳號密碼放在 source code #3

RammusXu opened this issue Jul 23, 2018 · 3 comments

Comments

@RammusXu
Copy link

RammusXu commented Jul 23, 2018

https://github.com/Shyam-Chen/Backend-Starter-Kit/blob/master/tools/Dockerfile.prod

在 docker run 的時候可以把 env 帶入 docker container

Dockerfile 裡面不要填入敏感的資訊

@Shyam-Chen
Copy link
Owner

Shyam-Chen commented Jul 26, 2018

會加到 .gitignore,步驟: https://github.com/Shyam-Chen/Backend-Starter-Kit#dockerization

# 現在我用這樣
env.js -> local
Dockerfile -> local
dev.Dockerfile -> development
stage.Dockerfile -> staging
prod.Dockerfile -> production

# 有可能這樣
env.js -> local
.env.dev -> development  # 把 env 帶入 container
.env.stage -> staging  # 把 env 帶入 container
.env.prod -> production  # 把 env 帶入 container
Dockerfile -> common

我現在的做法是把映像檔推到 Docker Cloud,CI 或 K8s 再從 Docker Cloud 拉下來
由於 CI 對 Dotenv 不是說很好去使用,所以從 process.env 來去操作
當然在 Docker 建置的時候,會看到環境變數,所以 Production 的 CI 權限要控管

@Shyam-Chen
Copy link
Owner

我將它放入 backlog

@Shyam-Chen
Copy link
Owner

Shyam-Chen commented Dec 21, 2020

#6 在 CircleCI 用參數動態設定環境變數就可以了,下一步用 Encrypted Files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants