1
+ # syntax=docker/dockerfile:1
1
2
# escape=`
2
3
3
- ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022-amd64
4
-
5
- FROM ${BASE_IMAGE}
6
-
7
- SHELL ["cmd" , "/S" , "/C" ]
8
-
9
- ENV GIT_VERSION=2.47.1
10
-
11
- RUN `
12
- # Download Git
13
- `
14
- curl -SL --output git.zip https://github.com/git-for-windows/git/releases/download/v%GIT_VERSION%.windows.1/MinGit-%GIT_VERSION%-64-bit.zip `
15
- `
16
- && mkdir "C:\\ git" `
17
- `
18
- && tar -xf git.zip -C "C:\\ git" `
19
- `
20
- && setx PATH "%PATH%;C:\\ git\\ cmd" /M `
21
- `
22
- && del /q git.zip
23
-
24
- RUN `
25
- # Post git configuration
26
- `
27
- git config --system --add safe.directory *
28
-
29
- ENV PYTHON_VERSION=3.11.0
30
-
31
- RUN `
32
- # Download Python
33
- `
34
- curl -SL --output python.zip https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-embed-amd64.zip `
35
- `
36
- && mkdir "C:\\ python" `
37
- `
38
- && tar -xf python.zip -C "C:\\ python" `
39
- `
40
- && setx PATH "%PATH%;C:\\ python" /M `
41
- `
42
- && del /q python.zip
43
-
44
- ENV NODEJS_MSI=https://nodejs.org/dist/v18.19.0/node-v18.19.0-x64.msi
45
-
46
- RUN `
47
- # Install Node LTS
48
- `
49
- curl -SL --output nodejs.msi %NODEJS_MSI% `
50
- `
51
- && msiexec /i nodejs.msi /qn `
52
- `
53
- && del /q nodejs.msi
54
-
55
- ENV GIT_GODBOLT_REPOSITORY_PATH=C:\c ompiler-explorer
56
- ENV CE_URL=https://github.com/Devsh-Graphics-Programming/compiler-explorer.git
57
- ENV CE_SHA=ce980aded514ae6a0a1b1f63e7fb358e57c9ed57
58
-
59
- RUN `
60
- # Checkout Compiler-Explorer
61
- `
62
- mkdir %GIT_GODBOLT_REPOSITORY_PATH% `
63
- `
64
- && git -C %GIT_GODBOLT_REPOSITORY_PATH% init `
65
- `
66
- && git -C %GIT_GODBOLT_REPOSITORY_PATH% remote add origin %CE_URL% `
67
- `
68
- && git -C %GIT_GODBOLT_REPOSITORY_PATH% fetch --depth=1 -- origin %CE_SHA% `
69
- `
70
- && git -C %GIT_GODBOLT_REPOSITORY_PATH% checkout %CE_SHA% `
71
- `
72
- && setx GIT_GODBOLT_REPOSITORY_PATH %GIT_GODBOLT_REPOSITORY_PATH% /M
73
-
74
- ENV NODE_OPTIONS="--max-old-space-size=4096"
75
-
76
- RUN `
77
- # Install Node.js dependencies & precompile production
78
- `
79
- cd %GIT_GODBOLT_REPOSITORY_PATH% `
80
- `
81
- && npm ci `
82
- `
83
- && npm run webpack
84
-
85
- RUN `
86
- # Post registry configuration
87
- `
88
- reg add "HKLM\S YSTEM\C urrentControlSet\C ontrol\F ileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f
89
-
90
- COPY ce_healthy_check.py /ce_healthy_check.py
91
-
92
- SHELL ["powershell.exe" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
93
- ENTRYPOINT ["powershell.exe" , "-ExecutionPolicy" , "Bypass" ]
94
- CMD ["-NoExit" ]
4
+ # ---------------- GLOBAL VARS ----------------
5
+ ARG NODE_VERSION=23.10.0
6
+
7
+ ARG GODBOLT_REMOTE=https://github.com/compiler-explorer/compiler-explorer.git
8
+ ARG GODBOLT_SHA=fc1b97ef9325eacbb8100d280aee0b0158a5adca
9
+
10
+ ARG IMPL_NANO_BASE=mcr.microsoft.com/powershell
11
+ ARG IMPL_NANO_TAG=lts-nanoserver-ltsc2022
12
+ ARG IMPL_GIT_VERSION=2.48.1
13
+ ARG IMPL_ARTIFACTS_DIR="C:\a rtifacts"
14
+
15
+ # ---------------- NODE JS ----------------
16
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as node
17
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
18
+
19
+ ARG NODE_VERSION
20
+ ARG IMPL_ARTIFACTS_DIR
21
+
22
+ RUN Write-Host "Installing NodeJS $env:NODE_VERSION" ; `
23
+ New-Item -ItemType Directory -Force -Path "C:\T emp" , $env:IMPL_ARTIFACTS_DIR ; `
24
+ Invoke-WebRequest -Uri https://nodejs.org/download/release/latest/node-v$env:NODE_VERSION-win-x64.zip -OutFile C:\T emp\n odejs.zip ; `
25
+ tar -xf C:\T emp\n odejs.zip -C $env:IMPL_ARTIFACTS_DIR ; Remove-Item C:\T emp\n odejs.zip
26
+
27
+ # ---------------- GIT ----------------
28
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as git
29
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
30
+
31
+ ARG IMPL_GIT_VERSION
32
+ ARG IMPL_ARTIFACTS_DIR
33
+
34
+ RUN Write-Host "Installing Git $env:IMPL_GIT_VERSION" ; `
35
+ New-Item -ItemType Directory -Force -Path C:\T emp, $env:IMPL_ARTIFACTS_DIR ; `
36
+ Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v$env:IMPL_GIT_VERSION.windows.1/MinGit-$env:IMPL_GIT_VERSION-busybox-64-bit.zip" -OutFile C:\T emp\g it.zip ; `
37
+ tar -xf C:\T emp\g it.zip -C $env:IMPL_ARTIFACTS_DIR ; Remove-Item C:\T emp\g it.zip
38
+
39
+ # ---------------- COMPILER EXPLORER ----------------
40
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as compiler-explorer
41
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
42
+
43
+ ARG NODE_VERSION
44
+ ARG IMPL_ARTIFACTS_DIR
45
+
46
+ COPY --link --from=node ["${IMPL_ARTIFACTS_DIR}/node-v${NODE_VERSION}-win-x64" , "C:/Node" ]
47
+ COPY --link --from=git ["${IMPL_ARTIFACTS_DIR}" , "C:/Git" ]
48
+ ENV PATH="C:\W indows\s ystem32;C:\W indows;C:\P rogram Files\P owerShell;C:\G it\c md;C:\G it\b in;C:\G it\u sr\b in;C:\G it\m ingw64\b in;C:\N ode"
49
+
50
+ ARG GODBOLT_REMOTE
51
+ ARG GODBOLT_SHA
52
+
53
+ RUN Write-Host "Installing Compiler Explorer" ; Write-Host "Remote $env:GODBOLT_REMOTE" ; Write-Host "SHA $env:GODBOLT_SHA" ; `
54
+ New-Item -ItemType Directory -Force -Path $env:IMPL_ARTIFACTS_DIR ; `
55
+ git config --system --add safe.directory * ; `
56
+ git -C "$env:IMPL_ARTIFACTS_DIR" init ; `
57
+ git -C "$env:IMPL_ARTIFACTS_DIR" remote add origin $env:GODBOLT_REMOTE ; `
58
+ git -C "$env:IMPL_ARTIFACTS_DIR" fetch --depth=1 -- origin $env:GODBOLT_SHA ; `
59
+ git -C "$env:IMPL_ARTIFACTS_DIR" checkout $env:GODBOLT_SHA
60
+
61
+ COPY scripts/build-win.ps1 ${IMPL_ARTIFACTS_DIR}/build-win.ps1
62
+ WORKDIR ${IMPL_ARTIFACTS_DIR}
63
+ ENV NODE_OPTIONS="--max-old-space-size=69000"
64
+ RUN cd $env:IMPL_ARTIFACTS_DIR ; `
65
+ Write-Host "Building Compiler Explorer" ; `
66
+ pwsh -File build-win.ps1 -CEWD "$env:IMPL_ARTIFACTS_DIR"
67
+
68
+ # ---------------- FINAL IMAGE ----------------
69
+ FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
70
+
71
+ ARG IMPL_ARTIFACTS_DIR
72
+ ARG NODE_VERSION
73
+
74
+ USER ContainerAdministrator
75
+
76
+ COPY --link --from=node ["${IMPL_ARTIFACTS_DIR}/node-v${NODE_VERSION}-win-x64" , "C:/Node" ]
77
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/dist" , "C:/Compiler-Explorer" ]
78
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/dist-bin/dist" , "C:/Compiler-Explorer" ]
79
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/webpack/static" , "C:/Compiler-Explorer/static" ]
80
+
81
+ ENV NODE_VERSION=${NODE_VERSION} NODE_ENV=production `
82
+ PATH="C:\W indows\s ystem32;C:\W indows;C:\P rogram Files\P owerShell;C:\N ode"
83
+
84
+ EXPOSE 10240
85
+ WORKDIR C:\\ Compiler-Explorer
86
+ ENTRYPOINT ["cmd.exe" , "/C" ]
87
+ CMD ["node" , "--no-warnings" , "--no-deprecation" , "--import=tsx" , "./app.js" , "--language" , "python" ]
88
+ # for instance, <...> --language HLSL; note we are running without any compilers in this example, one have to provide them
0 commit comments