-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from wings-software/CI-15981
feat: [CI-15981]: use non-root user for drone-git docker image for wi…
- Loading branch information
Showing
3 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# escape=` | ||
|
||
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as core | ||
|
||
|
||
FROM mcr.microsoft.com/windows/servercore:1809 AS git | ||
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` | ||
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/MinGit-2.39.2-64-bit.zip -OutFile git.zip; ` | ||
Expand-Archive git.zip -DestinationPath C:\git; | ||
|
||
# Download and extract Git LFS (Updated to v3.6.0) | ||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` | ||
Invoke-WebRequest -UseBasicParsing https://github.com/git-lfs/git-lfs/releases/download/v3.6.0/git-lfs-windows-amd64-v3.6.0.zip -OutFile git-lfs.zip; ` | ||
Expand-Archive git-lfs.zip -DestinationPath C:\git-lfs; | ||
|
||
RUN Add-WindowsCapability -Online -Name OpenSSH.Client* | ||
|
||
|
||
FROM mcr.microsoft.com/powershell:nanoserver-1809 | ||
COPY --from=git /git /git | ||
COPY --from=git /git-lfs /git-lfs | ||
|
||
COPY --from=git C:\Windows\System32\OpenSSH\ /openssh | ||
COPY --from=core /windows/system32/netapi32.dll /windows/system32/netapi32.dll | ||
|
||
ADD windows/* /bin/ | ||
|
||
# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137 | ||
USER ContainerAdministrator | ||
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;C:\openssh;C:\git-lfs\git-lfs-3.6.0" | ||
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
USER ContainerUser | ||
CMD [ "pwsh", "C:\\bin\\clone.ps1" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# escape=` | ||
|
||
FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS git | ||
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` | ||
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/MinGit-2.39.2-64-bit.zip -OutFile git.zip; ` | ||
Expand-Archive git.zip -DestinationPath C:\git; | ||
|
||
# Download and extract Git LFS | ||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` | ||
Invoke-WebRequest -UseBasicParsing https://github.com/git-lfs/git-lfs/releases/download/v3.6.0/git-lfs-windows-amd64-v3.6.0.zip -OutFile git-lfs.zip; ` | ||
Expand-Archive git-lfs.zip -DestinationPath C:\git-lfs; | ||
|
||
RUN Add-WindowsCapability -Online -Name OpenSSH.Client* | ||
|
||
|
||
FROM mcr.microsoft.com/powershell:windowsservercore-ltsc2022 | ||
COPY --from=git /git /git | ||
COPY --from=git /git-lfs /git-lfs | ||
|
||
COPY --from=git C:\Windows\System32\OpenSSH\ /openssh | ||
|
||
ADD windows/* /bin/ | ||
|
||
# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137 | ||
USER ContainerAdministrator | ||
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;C:\openssh;C:\git-lfs\git-lfs-3.6.0" | ||
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
USER ContainerUser | ||
CMD [ "pwsh", "C:\\bin\\clone.ps1" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters