1
+ # syntax=docker/dockerfile:1
2
+ # escape=`
3
+
4
+ # ---------------- GLOBAL VARS ----------------
5
+ ARG NODE_VERSION=23.10.0
6
+
7
+ # TODO: YAS please fix our lib/compilers/nsc-spirv.ts errors
8
+ # ARG GODBOLT_REMOTE=https://github.com/compiler-explorer/compiler-explorer.git
9
+ # ARG GODBOLT_SHA=cbbbe343dd1594c922a091b1e98b6c81dbe2c2b3
10
+
11
+ # TMP from original upstream
12
+ ARG GODBOLT_REMOTE=https://github.com/compiler-explorer/compiler-explorer.git
13
+ ARG GODBOLT_SHA=6b5553d7267afe76ae4f2edceed3fb346309cc3d
14
+
1
15
ARG IMPL_NANO_BASE=mcr.microsoft.com/powershell
2
16
ARG IMPL_NANO_TAG=lts-nanoserver-ltsc2022
17
+ ARG IMPL_GIT_VERSION=2.48.1
3
18
ARG IMPL_ARTIFACTS_DIR="C:\a rtifacts"
4
- ARG NODE_VERSION=23.10.0
5
19
6
- # nodejs
20
+ # ---------------- NODE JS ----------------
7
21
FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as node
8
22
SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
9
23
10
24
ARG NODE_VERSION
11
25
ARG IMPL_ARTIFACTS_DIR
12
26
13
- RUN New-Item -ItemType Directory -Force -Path "C:\T emp" , $env:IMPL_ARTIFACTS_DIR && Invoke-WebRequest -Uri https://nodejs.org/download/release/latest/node-v$env:NODE_VERSION-win-x64.zip -OutFile C:\T emp\n odejs.zip && tar -xf C:\T emp\n odejs.zip -C $env:IMPL_ARTIFACTS_DIR && Remove-Item C:\T emp\n odejs.zip && ls $env:IMPL_ARTIFACTS_DIR
27
+ RUN Write-Host "Installing NodeJS $env:NODE_VERSION" ; `
28
+ New-Item -ItemType Directory -Force -Path "C:\T emp" , $env:IMPL_ARTIFACTS_DIR ; `
29
+ Invoke-WebRequest -Uri https://nodejs.org/download/release/latest/node-v$env:NODE_VERSION-win-x64.zip -OutFile C:\T emp\n odejs.zip ; `
30
+ tar -xf C:\T emp\n odejs.zip -C $env:IMPL_ARTIFACTS_DIR ; Remove-Item C:\T emp\n odejs.zip
31
+
32
+ # ---------------- GIT ----------------
33
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as git
34
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
35
+
36
+ ARG IMPL_GIT_VERSION
37
+ ARG IMPL_ARTIFACTS_DIR
38
+
39
+ RUN Write-Host "Installing Git $env:IMPL_GIT_VERSION" ; `
40
+ New-Item -ItemType Directory -Force -Path C:\T emp, $env:IMPL_ARTIFACTS_DIR ; `
41
+ 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 ; `
42
+ tar -xf C:\T emp\g it.zip -C $env:IMPL_ARTIFACTS_DIR ; Remove-Item C:\T emp\g it.zip
14
43
15
- # compiler-explorer
44
+ # ---------------- COMPILER EXPLORER ----------------
16
45
FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as compiler-explorer
17
46
SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
18
47
48
+ ARG NODE_VERSION
19
49
ARG IMPL_ARTIFACTS_DIR
20
50
21
- RUN New-Item -ItemType Directory -Force -Path "C:\T emp" , $env:IMPL_ARTIFACTS_DIR && Invoke-WebRequest -Uri https://github.com/Devsh-Graphics-Programming/compiler-explorer/archive/refs/heads/main.zip -OutFile C:\T emp\C ompilerExplorer.zip && tar -xf C:\T emp\C ompilerExplorer.zip -C $env:IMPL_ARTIFACTS_DIR && Remove-Item C:\T emp\C ompilerExplorer.zip
51
+ COPY --link --from=node ["${IMPL_ARTIFACTS_DIR}/node-v${NODE_VERSION}-win-x64" , "C:/Node" ]
52
+ COPY --link --from=git ["${IMPL_ARTIFACTS_DIR}" , "C:/Git" ]
53
+ 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"
54
+
55
+ ARG GODBOLT_REMOTE
56
+ ARG GODBOLT_SHA
57
+
58
+ RUN Write-Host "Installing Compiler Explorer" ; Write-Host "Remote $env:GODBOLT_REMOTE" ; Write-Host "SHA $env:GODBOLT_SHA" ; `
59
+ New-Item -ItemType Directory -Force -Path $env:IMPL_ARTIFACTS_DIR ; `
60
+ git config --system --add safe.directory * ; `
61
+ git -C "$env:IMPL_ARTIFACTS_DIR" init ; `
62
+ git -C "$env:IMPL_ARTIFACTS_DIR" remote add origin $env:GODBOLT_REMOTE ; `
63
+ git -C "$env:IMPL_ARTIFACTS_DIR" fetch --depth=1 -- origin $env:GODBOLT_SHA ; `
64
+ git -C "$env:IMPL_ARTIFACTS_DIR" checkout $env:GODBOLT_SHA
65
+
66
+ COPY scripts/build-win.ps1 ${IMPL_ARTIFACTS_DIR}/build-win.ps1
67
+ WORKDIR ${IMPL_ARTIFACTS_DIR}
68
+ ENV NODE_OPTIONS="--max-old-space-size=69000"
69
+ RUN cd $env:IMPL_ARTIFACTS_DIR ; `
70
+ Write-Host "Building Compiler Explorer" ; `
71
+ pwsh -File build-win.ps1 -CEWD "$env:IMPL_ARTIFACTS_DIR"
22
72
23
- # final image
73
+ # ---------------- FINAL IMAGE ----------------
24
74
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
25
- SHELL ["cmd.exe" , "/C" ]
26
75
27
76
ARG IMPL_ARTIFACTS_DIR
28
77
ARG NODE_VERSION
29
78
79
+ USER ContainerAdministrator
80
+
30
81
COPY --link --from=node ["${IMPL_ARTIFACTS_DIR}/node-v${NODE_VERSION}-win-x64" , "C:/Node" ]
31
- COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/compiler-explorer-main" , "C:/Compiler-Explorer" ]
82
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/dist" , "C:/Compiler-Explorer" ]
83
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/dist-bin/dist" , "C:/Compiler-Explorer" ]
84
+ COPY --link --from=compiler-explorer ["${IMPL_ARTIFACTS_DIR}/out/webpack/static" , "C:/Compiler-Explorer/static" ]
32
85
33
- USER ContainerAdministrator
34
- ENV NODE_VERSION=${NODE_VERSION} NODE_OPTIONS= "--max-old-space-size=4096" GIT_VERSION=${GIT_VERSION} 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"
86
+ ENV NODE_VERSION=${NODE_VERSION} NODE_ENV=production `
87
+ PATH="C:\W indows\s ystem32;C: \W indows;C:\P rogram Files\P owerShell;C:\N ode"
35
88
36
89
EXPOSE 10240
37
90
WORKDIR C:\\ Compiler-Explorer
38
-
39
- RUN npm install && npm run webpack
40
-
41
91
ENTRYPOINT ["cmd.exe" , "/C" ]
42
- CMD ["npm" , "run" , "start" ]
92
+ CMD ["node" , "--import=tsx" , "./app.js" ]
93
+ # <...> --language HLSL, for instance
0 commit comments