Skip to content

Commit 3f5708e

Browse files
committed
let override publish CE port & control its URL depending on NBL_DOCKER_DIND_BUILD, update CMakePresets.json
1 parent 9bd8682 commit 3f5708e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

CMakePresets.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"NBL_EXPLICIT_MODULE_LOAD_LOG": "ON",
2020
"NBL_CPACK_NO_BUILD_DIRECTORY_MODULES": "ON",
2121
"NBL_CPACK_CI": "ON",
22-
"GIT_FAIL_IF_NONZERO_EXIT": "OFF"
22+
"GIT_FAIL_IF_NONZERO_EXIT": "OFF",
23+
"NBL_DOCKER_DIND_BUILD": "ON",
24+
"NBL_CE_PUBLISH_PORT": "10240"
2325
}
2426
},
2527
{

tools/nsc/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,17 @@ if(NOT EXISTS ${ICU_DIR} OR NOT EXISTS ${ICU_DLL})
222222
endif()
223223

224224
set(ORPHAN nsc-orphan)
225-
set(NBL_CE_URL http://${ORPHAN}:10240)
225+
226+
if(NOT DEFINED NBL_CE_PUBLISH_PORT)
227+
set(NBL_CE_PUBLISH_PORT 80)
228+
endif()
229+
230+
if(NBL_DOCKER_DIND_BUILD)
231+
set(NBL_CE_URL http://${ORPHAN}:${NBL_CE_PUBLISH_PORT})
232+
else()
233+
set(NBL_CE_URL http://localhost:${NBL_CE_PUBLISH_PORT})
234+
endif()
235+
226236
set(NBL_CE_HEALTHY_CHECK_PY "${NBL_ROOT_PATH}/docker/compiler-explorer/ce_healthy_check.py")
227237
set(NBL_CE_ENDPOINT_PY "${NBL_ROOT_PATH}/docker/compiler-explorer/endpoint.py")
228238
set(NBL_NSC_BASIC_HLSL_JPAYLOAD "${CMAKE_CURRENT_SOURCE_DIR}/docker/godbolt/hlsl-basic-compile-payload.json")
@@ -269,8 +279,8 @@ execute_process(COMMAND "${DOCKER_EXE}" build --isolation process
269279
COMMAND_ERROR_IS_FATAL ANY)
270280
271281
message(STATUS "Running new NSC orphan container")
272-
execute_process(COMMAND "${DOCKER_EXE}" run -di -p 80:10240 --isolation process
273-
--name "${ORPHAN}"
282+
execute_process(COMMAND "${DOCKER_EXE}" run -di -p ${NBL_CE_PUBLISH_PORT}:10240 --isolation process
283+
--name "${ORPHAN}" --network docker_default
274284
-v $<PATH:NORMAL_PATH,${ICU_DIR}:${ICU_DIR}:ro>
275285
-v $<PATH:NORMAL_PATH,C:/Windows/System32:C:/mount/Windows/System32:ro>
276286
${NSC_IMAGE_NAME}
@@ -292,7 +302,7 @@ message(STATUS "Printing NSC container logs")
292302
execute_process(COMMAND "${DOCKER_EXE}" logs "${ORPHAN}" COMMAND_ERROR_IS_FATAL ANY)
293303
294304
message(STATUS "OK! NSC container is healthy.")
295-
message(STATUS "Type \"localhost\" in your browser to use NSC with Godbolt!")
305+
message(STATUS "Type \"${NBL_CE_URL}\" in your browser to use NSC with Godbolt!")
296306
]=] INSTRUCTIONS)
297307

298308
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/run-compiler-explorer-$<CONFIG>.cmake" CONTENT "${INSTRUCTIONS}")

0 commit comments

Comments
 (0)