Skip to content

Commit

Permalink
Add git to dockerfiles (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: Bogdan-marius Pradatu <[email protected]>
  • Loading branch information
pBogey and Bogdan-marius Pradatu authored Dec 7, 2021
1 parent 31833d4 commit 350af4a
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 10 deletions.
5 changes: 3 additions & 2 deletions 11/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ ENV JENKINS_AGENT_HOME ${JENKINS_AGENT_HOME}
RUN groupadd -g ${gid} ${group} \
&& useradd -d "${JENKINS_AGENT_HOME}" -u "${uid}" -g "${gid}" -m -s /bin/bash "${user}"

# setup SSH server
RUN apt-get update \
&& apt-get install --no-install-recommends -y openssh-server \
&& apt-get install --no-install-recommends -y openssh-server git-lfs \
&& rm -rf /var/lib/apt/lists/*

# setup SSH server
RUN sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
Expand Down
20 changes: 19 additions & 1 deletion 11/windows/nanoserver-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,27 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
Expand-Archive openjdk.zip -DestinationPath C:/ ; `
Remove-Item -Path openjdk.zip

ARG GIT_VERSION=2.33.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Remove-Item mingit.zip -Force

ARG GIT_LFS_VERSION=3.0.2
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; `
Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; `
Remove-Item GitLfs.zip -Force ; `
& C:\mingit\cmd\git.exe lfs install

ENV ProgramFiles="C:\Program Files"
ENV WindowsPATH="C:\Windows\system32;C:\Windows"
ENV PATH="${WindowsPATH};${ProgramFiles}\PowerShell;${JAVA_HOME}\bin"
ENV PATH="${WindowsPATH};${ProgramFiles}\PowerShell;${JAVA_HOME}\bin;C:\mingit\cmd"

ARG OPENSSH_VERSION=V8.6.0.0p1-Beta

Expand Down
22 changes: 22 additions & 0 deletions 11/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ ENV JENKINS_AGENT_WORK ${JENKINS_AGENT_WORK}

USER ContainerAdministrator

# install git
ARG GIT_VERSION=2.33.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Remove-Item mingit.zip -Force

ARG GIT_LFS_VERSION=3.0.2
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; `
Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; `
Remove-Item GitLfs.zip -Force ; `
& C:\mingit\cmd\git.exe lfs install ; `
$CurrentPath = (Get-Itemproperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path).Path ; `
$NewPath = $CurrentPath + ';C:\mingit\cmd' ; `
Set-ItemProperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path -Value $NewPath

# setup SSH server
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = 'https://github.com/PowerShell/Win32-OpenSSH/releases/download/{0}/OpenSSH-Win64.zip' -f $env:OPENSSH_VERSION ; `
Expand Down
5 changes: 3 additions & 2 deletions 17/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ ENV JENKINS_AGENT_HOME ${JENKINS_AGENT_HOME}
RUN groupadd -g ${gid} ${group} \
&& useradd -d "${JENKINS_AGENT_HOME}" -u "${uid}" -g "${gid}" -m -s /bin/bash "${user}"

# setup SSH server
RUN apt-get update \
&& apt-get install --no-install-recommends -y openssh-server \
&& apt-get install --no-install-recommends -y openssh-server git-lfs \
&& rm -rf /var/lib/apt/lists/*

# setup SSH server
RUN sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
Expand Down
5 changes: 3 additions & 2 deletions 8/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ RUN mkdir -p "${JENKINS_AGENT_HOME}" \
# Unblock user
&& passwd -u "${user}"

# setup SSH server
RUN apk update --no-cache \
&& apk add --no-cache \
bash \
openssh
openssh \
git-lfs

# setup SSH server
RUN sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#PasswordAuthentication.*/PasswordAuthentication no/' \
Expand Down
5 changes: 3 additions & 2 deletions 8/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ ENV JENKINS_AGENT_HOME ${JENKINS_AGENT_HOME}
RUN groupadd -g ${gid} ${group} \
&& useradd -d "${JENKINS_AGENT_HOME}" -u "${uid}" -g "${gid}" -m -s /bin/bash "${user}"

# setup SSH server
RUN apt-get update \
&& apt-get install --no-install-recommends -y openssh-server \
&& apt-get install --no-install-recommends -y openssh-server git-lfs\
&& rm -rf /var/lib/apt/lists/*

# setup SSH server
RUN sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
Expand Down
20 changes: 19 additions & 1 deletion 8/windows/nanoserver-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,27 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
Expand-Archive openjdk.zip -DestinationPath C:/ ; `
Remove-Item -Path openjdk.zip

ARG GIT_VERSION=2.33.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Remove-Item mingit.zip -Force

ARG GIT_LFS_VERSION=2.13.3
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; `
Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; `
Remove-Item GitLfs.zip -Force ; `
& C:\mingit\cmd\git.exe lfs install

ENV ProgramFiles="C:\Program Files"
ENV WindowsPATH="C:\Windows\system32;C:\Windows"
ENV PATH="${WindowsPATH};${ProgramFiles}\PowerShell;${JAVA_HOME}\bin"
ENV PATH="${WindowsPATH};${ProgramFiles}\PowerShell;${JAVA_HOME}\bin;C:\mingit\cmd"

ARG OPENSSH_VERSION=V8.6.0.0p1-Beta

Expand Down
22 changes: 22 additions & 0 deletions 8/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ ENV JENKINS_AGENT_WORK ${JENKINS_AGENT_WORK}

USER ContainerAdministrator

# Install git
ARG GIT_VERSION=2.33.1
ARG GIT_PATCH_VERSION=1
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'mingit.zip' -UseBasicParsing ; `
Expand-Archive mingit.zip -DestinationPath c:\mingit ; `
Remove-Item mingit.zip -Force

ARG GIT_LFS_VERSION=3.0.2
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = $('https://github.com/git-lfs/git-lfs/releases/download/v{0}/git-lfs-windows-amd64-v{0}.zip' -f $env:GIT_LFS_VERSION) ; `
Write-Host "Retrieving $url..." ; `
Invoke-WebRequest $url -OutFile 'GitLfs.zip' -UseBasicParsing ; `
Expand-Archive GitLfs.zip -DestinationPath c:\mingit\mingw64\bin ; `
Remove-Item GitLfs.zip -Force ; `
& C:\mingit\cmd\git.exe lfs install ; `
$CurrentPath = (Get-Itemproperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path).Path ; `
$NewPath = $CurrentPath + ';C:\mingit\cmd' ; `
Set-ItemProperty -path 'hklm:\system\currentcontrolset\control\session manager\environment' -Name Path -Value $NewPath

# setup SSH server
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
$url = 'https://github.com/PowerShell/Win32-OpenSSH/releases/download/{0}/OpenSSH-Win64.zip' -f $env:OPENSSH_VERSION ; `
Expand Down

0 comments on commit 350af4a

Please sign in to comment.