Setup git via windows docker file

后端 未结 4 1139
被撕碎了的回忆
被撕碎了的回忆 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 19:42

    You can download and use the Git Thumbdrive edition: https://git-scm.com/download/win

    look for the link under:

    Git for Windows Portable ("thumbdrive edition")

    E.G.: https://github.com/git-for-windows/git/releases/download/v2.23.0.windows.1/PortableGit-2.23.0-64-bit.7z.exe

    0 讨论(0)
  • 2021-01-22 19:48

    You are correct, both Windows and Linux containers generally focus on running headless applications (i.e. without GUI).

    It sounds like you want to create a container image based on the nanoserver image that has git?

    Chocolatey is a great idea.

    If you give me the broader context of your goals I can help you further.

    Cheers :)

    0 讨论(0)
  • 2021-01-22 20:05

    Call the git.setup.exe installation file with the parameters /? to list all possible switches.

    To run a silent installation: git.setup.exe /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS

    To do a customized installation:

    run manually git installation with the parameter /SAVEINF="filename"

    e.g:. git-2.xx.exe /SAVEINF="filename"

    And then to repeat the installation with /LOADINF="filename"

    e.g.: git.setup.exe /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /LOADINF="filename"

    It's documented on: Git: Silent-or-Unattended-Installation

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题