1
- # escape=`
1
+ ARG IMPL_NANO_BASE=mcr.microsoft.com/powershell
2
+ ARG IMPL_NANO_TAG=lts-nanoserver-ltsc2022
3
+ ARG IMPL_ARTIFACTS_DIR="C:\a rtifacts"
4
+ ARG NODE_VERSION=23.10.0
2
5
3
- ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022-amd64
6
+ # nodejs
7
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as node
8
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
4
9
5
- FROM ${BASE_IMAGE}
10
+ ARG NODE_VERSION
11
+ ARG IMPL_ARTIFACTS_DIR
6
12
7
- SHELL [ "cmd" , "/S " , "/C" ]
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
8
14
9
- ENV GIT_VERSION=2.47.1
15
+ # compiler-explorer
16
+ FROM ${IMPL_NANO_BASE}:${IMPL_NANO_TAG} as compiler-explorer
17
+ SHELL ["pwsh" , "-NoLogo" , "-NoProfile" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
10
18
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 *
19
+ ARG IMPL_ARTIFACTS_DIR
28
20
29
- ENV PYTHON_VERSION=3.11.0
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
30
22
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
23
+ # final image
24
+ FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
25
+ SHELL ["cmd.exe" , "/C" ]
43
26
44
- ENV NODEJS_MSI=https://nodejs.org/dist/v18.19.0/node-v18.19.0-x64.msi
27
+ ARG IMPL_ARTIFACTS_DIR
28
+ ARG NODE_VERSION
45
29
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
30
+ 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" ]
54
32
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
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"
58
35
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
36
+ EXPOSE 10240
37
+ WORKDIR C:\\ Compiler-Explorer
73
38
74
- ENV NODE_OPTIONS= "--max-old-space-size=4096"
39
+ RUN npm install && npm run webpack
75
40
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" ]
41
+ ENTRYPOINT ["cmd.exe" , "/C" ]
42
+ CMD ["npm" , "run" , "start" ]
0 commit comments