-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
82 lines (57 loc) · 2.85 KB
/
Dockerfile
File metadata and controls
82 lines (57 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# escape=`
# This file is auto-generated by PostSharp.Engineering.
FROM mcr.microsoft.com/windows/servercore:ltsc2025
# The initial shell is Windows PowerShell (use full path to avoid HCS issues)
SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-Command"]
# Prepare environment
ENV PSExecutionPolicyPreference=Bypass
ENV POWERSHELL_UPDATECHECK=Off
ENV TEMP=C:\Temp
ENV TMP=C:\Temp
ENV RUNNING_IN_DOCKER=TRUE
# Set locale for consistent behavior regardless of host locale
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV DOTNET_CLI_UI_LANGUAGE=en
ENV VSLANG=1033
# Set base PATH explicitly to avoid issues with expansion
ENV PATH="C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0"
# Enable long path support
RUN Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
# Install Git
RUN Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.50.0.windows.1/PortableGit-2.50.0-64-bit.7z.exe -OutFile PortableGit.exe; `
Start-Process -FilePath .\PortableGit.exe -ArgumentList '-o"C:\git"', '-y' -Wait; `
Remove-Item PortableGit.exe
# Add git to PATH using ENV directive (persists across shell switches)
ENV PATH="C:\git\cmd;C:\git\bin;C:\git\usr\bin;${PATH}"
RUN git config --system core.longpaths true; git config --system core.autocrlf false
# Set CLAUDE_CODE_GIT_BASH_PATH for Claude Code
ENV CLAUDE_CODE_GIT_BASH_PATH=C:\git\bin\bash.exe
# Install PowerShell 7
RUN Invoke-WebRequest -Uri https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/PowerShell-7.5.2-win-x64.msi -OutFile PowerShell.msi; `
$process = Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/I PowerShell.msi /quiet'; `
if ($process.ExitCode -ne 0) { exit $process.ExitCode }; `
Remove-Item PowerShell.msi
ENV PATH="C:\Program Files\PowerShell\7;${PATH}"
# Download .NET Installer
RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
# Add .NET to PATH using ENV directive (persists across shell switches)
ENV PATH="C:\Program Files\dotnet;${PATH}"
# Install .NET Sdk 9.0.310
RUN & .\dotnet-install.ps1 -Version 9.0.310 -InstallDir 'C:\Program Files\dotnet'
# Epilogue
# Link to private repository for GHCR visibility
LABEL org.opencontainers.image.source=https://github.com/postsharp/PostSharp.Engineering.Images
# Create directories for mountpoints
ARG MOUNTPOINTS
RUN if ($env:MOUNTPOINTS) { `
$mounts = $env:MOUNTPOINTS -split ';'; `
foreach ($dir in $mounts) { `
if ($dir) { `
Write-Host "Creating directory $dir`."; `
New-Item -ItemType Directory -Path $dir -Force | Out-Null; `
} `
} `
}
# Configure .NET SDK
ENV DOTNET_NOLOGO=1