-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.claude
More file actions
115 lines (80 loc) · 4.54 KB
/
Dockerfile.claude
File metadata and controls
115 lines (80 loc) · 4.54 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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'
# Install Node.js
RUN Invoke-WebRequest -Uri "https://nodejs.org/dist/v22.0.0/node-v22.0.0-win-x64.zip" -OutFile node.zip; `
Expand-Archive node.zip -DestinationPath C:\; `
Rename-Item "C:\node-v22.0.0-win-x64" "C:\nodejs"; `
Remove-Item node.zip
ENV NPM_CONFIG_PREFIX=C:\npm
ENV PATH="C:\nodejs;C:\npm;${PATH}"
# Install Claude CLI
# Set HOME/USERPROFILE so Claude CLI finds credentials during build
ENV HOME=C:\\Users\\ContainerAdministrator
ENV USERPROFILE=C:\\Users\\ContainerAdministrator
# Install Claude CLI and configure using cmd shell to avoid HCS issues with PowerShell
SHELL ["cmd", "/S", "/C"]
RUN C:\nodejs\npm.cmd install --global @anthropic-ai/claude-code@2.1.34
RUN mkdir C:\Users\ContainerAdministrator\.claude && echo {"hasCompletedOnboarding": true} > C:\Users\ContainerAdministrator\.claude.json && echo {"alwaysThinkingEnabled": true, "spinnerTipsEnabled": false} > C:\Users\ContainerAdministrator\.claude\settings.json
# Restore PowerShell shell using full path
SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-Command"]
# Install Claude CLI Add-ins
# Install Claude plugins using cmd shell to avoid HCS issues with PowerShell
SHELL ["cmd", "/S", "/C"]
RUN echo Installing Claude plugins && C:\npm\claude plugin marketplace add https://github.com/metalama/Metalama.AI.Skills && C:\npm\claude plugin marketplace add https://github.com/postsharp/PostSharp.Engineering.AISkills && C:\npm\claude plugin install metalama && C:\npm\claude plugin install metalama-dev && C:\npm\claude plugin install eng
# Restore PowerShell shell using full path
SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-Command"]
# 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