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

Docker 镜像加入 Git 提交哈希值环境变量 #82

Closed
88250 opened this issue Mar 24, 2020 · 0 comments
Closed

Docker 镜像加入 Git 提交哈希值环境变量 #82

88250 opened this issue Mar 24, 2020 · 0 comments
Assignees
Milestone

Comments

@88250
Copy link
Owner

88250 commented Mar 24, 2020

构建镜像时通过 git rev-parse --short HEAD 获取到 commit hash 然后作为镜像环境变量 $git_commit

镜像构建命令:

docker build --build-arg git_commit=$(git rev-parse --short HEAD)

Dockerfile:

ARG git_commit=0
ENV git_commit=$git_commit
@88250 88250 self-assigned this Mar 24, 2020
@88250 88250 added this to the 4.1.0 milestone Mar 24, 2020
@88250 88250 closed this as completed in 96400c0 Mar 25, 2020
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

1 participant