Skip to content

Add docker image#331

Merged
tbody-cfs merged 4 commits into
masterfrom
docker_image
Apr 25, 2025
Merged

Add docker image#331
tbody-cfs merged 4 commits into
masterfrom
docker_image

Conversation

@tbody-cfs
Copy link
Copy Markdown
Collaborator

See #329

This PR adds a docker image build recipe, and pushes images to Github's container registry for releases.

There is a README in the docker folder explaining how to use the image.

If you'd rather not have the extra complexity to manage, no need to merge. I was fixing some broken dependencies so sharing if it's useful.

@bendudson @mikekryjak

@tbody-cfs
Copy link
Copy Markdown
Collaborator Author

tbody-cfs commented Apr 22, 2025

Before the first image is publicly available, you'll need to build locally. If you have docker installed, you can do this using

cd /path/to/hermes-3-repository
docker build -t hermes3 -f docker/Dockerfile .

Then, you should be able to execute the commands in the README

@bendudson
Copy link
Copy Markdown
Collaborator

Amazing, thanks @tbody-cfs !

Comment thread CMakeLists.txt
Comment on lines 194 to 215
# Once built, copy the data and test directories
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/examples $<TARGET_FILE_DIR:${PROJECT_NAME}>/examples)
option(HERMES_COPY_EXAMPLES_TO_BUILD "Copy the examples to the build directory" ON)
if(HERMES_COPY_EXAMPLES_TO_BUILD)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/examples $<TARGET_FILE_DIR:${PROJECT_NAME}>/examples)
endif()

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/json_database $<TARGET_FILE_DIR:${PROJECT_NAME}>/json_database)
option(HERMES_COPY_JSON_DATABASE_TO_BUILD "Copy the json database to the build directory" ON)
if(HERMES_COPY_JSON_DATABASE_TO_BUILD)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/json_database $<TARGET_FILE_DIR:${PROJECT_NAME}>/json_database)
endif()

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/tests $<TARGET_FILE_DIR:${PROJECT_NAME}>/tests)
option(HERMES_COPY_TESTS_TO_BUILD "Copy the tests to the build directory" ON)
if(HERMES_COPY_TESTS_TO_BUILD)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/tests $<TARGET_FILE_DIR:${PROJECT_NAME}>/tests)
endif()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to add these extra options to reduce the docker image size.

Comment on lines +3 to +10
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,7 @@ message(STATUS "Configuring BOUT++ version ${BOUT_FULL_VERSION}")
project(BOUT++
DESCRIPTION "Fluid PDE solver framework"
VERSION ${BOUT_CMAKE_ACCEPTABLE_VERSION}
- LANGUAGES CXX)
+ LANGUAGES C CXX)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could use a BOUT version with boutproject/BOUT-dev#3101

@tbody-cfs
Copy link
Copy Markdown
Collaborator Author

Ready for merge

@tbody-cfs tbody-cfs merged commit 98a13e1 into master Apr 25, 2025
3 checks passed
@tbody-cfs tbody-cfs deleted the docker_image branch May 5, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants