Skip to content

Commit 76af008

Browse files
committed
update create-production-compiler-explorer target, label final NSC production image & add entrypoint, leave some comments for Yas
1 parent 5bebeb7 commit 76af008

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

tools/nsc/CMakeLists.txt

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ set(_OUTPUT_C_PATH_ "${_OUTPUT_DIRECTORY_}/compose.yml")
163163
string(CONFIGURE "${_EXTRA_DOCKERFILE_CONTENT_}" _EXTRA_DOCKERFILE_CONTENT_EVAL_ @ONLY)
164164
string(CONFIGURE "${_DOCKER_IGNORE_CONTENT_}" _DOCKER_IGNORE_CONTENT_EVAL_ @ONLY)
165165

166+
unset(DOCKER_CONTENT)
166167
string(APPEND DOCKER_CONTENT
167168
[=[
168169
# escape=`
@@ -191,6 +192,7 @@ endif()
191192

192193
set(_OUTPUT_I_PATH_ "${_CTX_TARGET_}/.dockerignore")
193194

195+
unset(COMPOSE_CONTENT)
194196
string(APPEND COMPOSE_CONTENT
195197
[=[
196198
services:
@@ -305,6 +307,7 @@ string(TOLOWER "${NABLA_DEV_ENV_CT_NAME}" NABLA_DEV_ENV_CT_NAME)
305307

306308
set(COMPOSE_NSC_DEV_SERVICE compiler-explorer-nsc-dev)
307309
string(TOLOWER "dr.devsh.eu/nabla/cmake-host-dev-env/${CMAKE_SYSTEM_NAME}/build/${CMAKE_CXX_COMPILER_ID}/compiler-explorer-nsc:latest" COMPOSE_NSC_DEV_IMAGE)
310+
string(TOLOWER "dr.devsh.eu/compiler-explorer/production/windows/nsc/orphan-production-test:latest" COMPOSE_NSC_ORPHAN_PRODUCTION_TEST_IMAGE)
308311
string(TOLOWER "dr.devsh.eu/compiler-explorer/production/windows/nsc:latest" COMPOSE_NSC_PRODUCTION_IMAGE)
309312

310313
string(APPEND COMPOSE_CONTENT
@@ -402,16 +405,41 @@ add_custom_target(is-compiler-explorer-running
402405
USES_TERMINAL
403406
)
404407

408+
# Production NSC image
409+
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docker/nsc-production")
410+
set(BASE_IMAGE "${COMPOSE_NSC_ORPHAN_PRODUCTION_TEST_IMAGE}")
405411
set(NBL_DOCKER_TMP_PRODUCTION_TARGET "C:\\target")
412+
GEN_DOCKER_CONTENT("" "${OUTPUT_DIRECTORY}"
413+
[=[
414+
LABEL maintainer="Arkadiusz Lachowicz <a.lachowicz@devsh.eu>" `
415+
org.opencontainers.image.authors="Arkadiusz Lachowicz <a.lachowicz@devsh.eu>" `
416+
org.opencontainers.image.title="Compiler Explorer with Nabla Shader Compilers in Docker" `
417+
org.opencontainers.image.description="Docker image to run Compiler Explorer instance with Nabla Shader Compilers" `
418+
org.opencontainers.image.url="https://github.com/Devsh-Graphics-Programming/Nabla" `
419+
org.opencontainers.image.source="https://github.com/Devsh-Graphics-Programming/Nabla" `
420+
org.opencontainers.image.documentation="https://github.com/Devsh-Graphics-Programming/Nabla/tree/master/tools/nsc/docker"
421+
422+
ENTRYPOINT ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command", "npm", "--prefix", "$env:GIT_GODBOLT_REPOSITORY_PATH", "start", "--", "--language", "hlsl"]
423+
]=]
424+
[=[
425+
426+
]=]
427+
nsc-ce-production
428+
nsc.ce.production
429+
${COMPOSE_NSC_PRODUCTION_IMAGE}
430+
OFF
431+
)
406432

407433
add_custom_target(create-production-compiler-explorer
408-
COMMAND "${DOCKER_EXE}" run -dit -v "${NBL_DOCKER_CT_NSC_VOLUME_SOURCE}:${NBL_DOCKER_TMP_PRODUCTION_TARGET}" --name production-ce-orphan --entrypoint "cmd" "${COMPOSE_NSC_DEV_IMAGE}"
409-
COMMAND "${DOCKER_EXE}" exec production-ce-orphan "${NBL_DOCKER_TMP_PRODUCTION_TARGET}\\${NBL_DOCKER_INSTALL_BAT_FILENAME}"
410-
# TODO: add final test -> run in production mode (npm start) + execute basic hlsl file compile checks for collected nsc compilers, if all good then commit
411-
COMMAND "${DOCKER_EXE}" stop production-ce-orphan
412-
COMMAND "${DOCKER_EXE}" commit production-ce-orphan "${COMPOSE_NSC_PRODUCTION_IMAGE}"
413-
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
414-
VERBATIM
434+
COMMAND "${DOCKER_EXE}" run -dit -v "${NBL_DOCKER_CT_NSC_VOLUME_SOURCE}:${NBL_DOCKER_TMP_PRODUCTION_TARGET}" --name production-ce-orphan-run-test --entrypoint "cmd" "${COMPOSE_NSC_DEV_IMAGE}"
435+
COMMAND "${DOCKER_EXE}" exec production-ce-orphan-run-test "${NBL_DOCKER_TMP_PRODUCTION_TARGET}\\${NBL_DOCKER_INSTALL_BAT_FILENAME}"
436+
COMMAND "${DOCKER_EXE}" stop production-ce-orphan-run-test
437+
COMMAND "${DOCKER_EXE}" commit production-ce-orphan-run-test "${COMPOSE_NSC_ORPHAN_PRODUCTION_TEST_IMAGE}"
438+
COMMAND "${DOCKER_EXE}" compose build
439+
# TODO (Yas): here -> run built final image, use host ce_healthy_check to detect if you see godbolt, then use some REST API (POST/GET) to collect ALL compilers from godbolt, check if they are all 3 and nsc_* named, check if they can all still compile basic HLSL input without crashing in the production
440+
# you can actually tag it with "-test" and if passes tests then tag as final :latest image
441+
WORKING_DIRECTORY "${OUTPUT_DIRECTORY}"
442+
VERBATIM
415443
USES_TERMINAL
416444
)
417445

0 commit comments

Comments
 (0)