Setup git via windows docker file

后端 未结 4 1175
被撕碎了的回忆
被撕碎了的回忆 2021-01-22 19:18

I write Dockerfile which is based on windowsnanoserver. I need to add to this image git. In order to achieve it I did the following:

RUN Invoke-WebR         


        
4条回答
  •  旧巷少年郎
    2021-01-22 20:09

    I've solved issue with GUI through usage of MinGit and by putting information about mingit into environment/path variable. I've used following approach:

    RUN Invoke-WebRequest 'https://github.com/git-for-windows/git/releases/download/v2.12.2.windows.2/MinGit-2.12.2.2-64-bit.zip' -OutFile MinGit.zip
    
    RUN Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit; \
    $env:PATH = $env:PATH + ';C:\MinGit\cmd\;C:\MinGit\cmd'; \
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
    

提交回复
热议问题