Skip to content

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

Closed
@88250

Description

@88250
Owner

构建镜像时通过 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

Activity

self-assigned this
on Mar 24, 2020
added this to the 4.1.0 milestone on Mar 24, 2020
added a commit that references this issue on Mar 25, 2020
96400c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250

      Issue actions

        Docker 镜像加入 Git 提交哈希值环境变量 · Issue #82 · 88250/solo