Skip to content

Commit 9f25ce5

Browse files
committed
make Nabla docker build "exec" based with git cache volume
1 parent bd57c8f commit 9f25ce5

File tree

24 files changed

+147
-1220
lines changed

24 files changed

+147
-1220
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ enable_language(C CXX ASM ASM_NASM)
1717

1818
if(MSVC)
1919
enable_language(ASM_MASM)
20+
link_libraries(delayimp)
2021
endif()
2122

2223
option(NBL_STATIC_BUILD "" OFF) # ON for static builds, OFF for shared

docker/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
THIS_PROJECT_WORKING_DIRECTORY=C:\docker
2+
THIS_PROJECT_NABLA_DIRECTORY=C:/Users/ContainerAdministrator/Nabla/bind

docker/Dockerfile

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# escape=`
2+
3+
ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022-amd64
4+
5+
FROM ${BASE_IMAGE}
6+
7+
SHELL ["cmd", "/S", "/C"]
8+
9+
USER ContainerAdministrator
10+
11+
ENV THIS_PROJECT_WORKING_DIRECTORY="C:\docker"
12+
ENV THIS_PROJECT_NABLA_DIRECTORY="C:/Users/ContainerAdministrator/Nabla/bind"
13+
ENV VULKAN_SDK_INSTALL_DIRECTORY="${THIS_PROJECT_WORKING_DIRECTORY}\dependencies\VulkanSDK"
14+
ENV VS_INSTALL_DIRECTORY="${THIS_PROJECT_WORKING_DIRECTORY}\dependencies\VS\BuildTools"
15+
16+
RUN `
17+
# Download the Build Tools (17.11.5 October 8, 2024 version) bootstrapper. https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
18+
`
19+
curl -SL --output vs_buildtools.exe https://download.visualstudio.microsoft.com/download/pr/69e24482-3b48-44d3-af65-51f866a08313/471c9a89fa8ba27d356748ae0cf25eb1f362184992dc0bb6e9ccf10178c43c27/vs_BuildTools.exe `
20+
`
21+
# Install Build Tools with the Microsoft.VisualStudio.Workload.VCTools recommended workload and ATL & ATLMFC, excluding some Windows SDKs.
22+
`
23+
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
24+
--installPath "%VS_INSTALL_DIRECTORY%" `
25+
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended `
26+
--add Microsoft.VisualStudio.Component.VC.ATL `
27+
--add Microsoft.VisualStudio.Component.VC.ATLMFC `
28+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
29+
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
30+
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
31+
--remove Microsoft.VisualStudio.Component.Windows81SDK `
32+
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) `
33+
`
34+
# Add VS's CMake to the system PATH and cleanup
35+
`
36+
&& setx PATH "%PATH%;%VS_INSTALL_DIRECTORY%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin" /M `
37+
`
38+
# Cleanup
39+
`
40+
&& del /q vs_buildtools.exe
41+
42+
ENV VS_DEV_CMD_DIRECTORY="${VS_INSTALL_DIRECTORY}\Common7\Tools"
43+
44+
RUN `
45+
# Add VS_DEV_CMD_DIRECTORY to the system PATH
46+
`
47+
setx PATH "%PATH%;%VS_DEV_CMD_DIRECTORY%" /M
48+
49+
RUN `
50+
# Download VulkanSDK
51+
`
52+
curl -SL --output VulkanSDK-Installer.exe https://sdk.lunarg.com/sdk/download/1.3.268.0/windows/VulkanSDK-1.3.268.0-Installer.exe `
53+
`
54+
# Install VulkanSDK
55+
`
56+
&& VulkanSDK-Installer.exe install --root "%VULKAN_SDK_INSTALL_DIRECTORY%" --default-answer --accept-licenses --confirm-command `
57+
`
58+
# Cleanup
59+
`
60+
&& del /q VulkanSDK-Installer.exe
61+
62+
RUN `
63+
# Download & install choco packet manager
64+
`
65+
powershell Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
66+
67+
RUN `
68+
# Download & install executable Strawberry Perl
69+
`
70+
choco install -y strawberryperl --version 5.28.2.1
71+
72+
RUN `
73+
# Download & install Python
74+
`
75+
choco install -y python --version 3.11.6
76+
77+
RUN `
78+
# Download & install git
79+
`
80+
choco install -y git --version 2.43.0
81+
82+
RUN `
83+
# Download & install nasm
84+
`
85+
choco install -y nasm --version 2.16.1
86+
87+
RUN `
88+
# Download & install ninja
89+
`
90+
choco install -y ninja --version 1.12.1
91+
92+
RUN `
93+
# Enable Long Paths feature
94+
`
95+
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f
96+
97+
RUN `
98+
# Force git to use HTTPS protocol & trust containers
99+
`
100+
git config --system protocol.*.allow always `
101+
`
102+
&& git config --system url."https://github.com/".insteadOf "git@github.com:" `
103+
`
104+
&& git config --system --add safe.directory *
105+
106+
RUN `
107+
# Post environment setup
108+
`
109+
setx VS_INSTALL_DIRECTORY "%VS_INSTALL_DIRECTORY%" /M `
110+
`
111+
&& setx PATH "%PATH%;%VS_INSTALL_DIRECTORY%\VC\Auxiliary\Build" /M `
112+
`
113+
&& setx NBL_CI_MODE "ON"
114+
115+
WORKDIR ${THIS_PROJECT_NABLA_DIRECTORY}
116+
ENTRYPOINT ["cmd.exe", "/K"]

docker/compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
nabla:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
image: dcr.devsh.eu/nabla/source
7+
container_name: dev.nabla.build
8+
env_file:
9+
- .env
10+
environment:
11+
- THIS_PROJECT_WORKING_DIRECTORY=${THIS_PROJECT_WORKING_DIRECTORY}
12+
- THIS_PROJECT_NABLA_DIRECTORY=${THIS_PROJECT_NABLA_DIRECTORY}
13+
volumes:
14+
- nabla-cache-git:${THIS_PROJECT_NABLA_DIRECTORY}/.git
15+
networks:
16+
docker_default:
17+
deploy:
18+
resources:
19+
limits:
20+
cpus: '6'
21+
memory: 12G
22+
23+
volumes:
24+
nabla-cache-git:
25+
26+
networks:
27+
docker_default:
28+
external: true

docker/compose/Dockerfile

Lines changed: 0 additions & 162 deletions
This file was deleted.

docker/compose/ci/stages/.env/platform/windows/.env

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)