Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,26 @@ target_link_libraries(cpackexamplelib Boost::filesystem ${YAML_CPP_LIBRARIES})

DEAL_II_SETUP_TARGET("${PROJECT_NAME}")
DEAL_II_SETUP_TARGET(cpackexamplelib)

# Install the executable to <prefix>/bin/
install(TARGETS "${PROJECT_NAME}"
RUNTIME DESTINATION bin
)

# Install the library to <prefix>/lib/
install(TARGETS cpackexamplelib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)

# Install header files to <prefix>/include/cpackexamplelib/
install(FILES
fem/fem.hpp
filesystem/filesystem.hpp
flatset/flatset.hpp
yamlParser/yamlParser.hpp
DESTINATION include/cpackexamplelib
)

# Include CPack configuration
include(cmake/CPackConfig.cmake)
36 changes: 33 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ubuntu:24.04
FROM ubuntu:24.04

# Install a few dependencies
RUN apt-get -qq update && \
Expand All @@ -12,7 +12,10 @@ RUN apt-get -qq update && \
vim \
tree \
lintian \
unzip
tree \
lintian \
unzip \
rsync

# Get, unpack, build, and install yaml-cpp
RUN mkdir software && cd software && \
Expand All @@ -25,4 +28,31 @@ ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib/
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib/
ENV PATH $PATH:/usr/local/bin/

CMD ["/bin/bash"]
# Create entrypoint script inside the image
RUN echo '#!/bin/bash' > /entrypoint.sh && \
echo 'set -e' >> /entrypoint.sh && \
echo 'SOURCE_DIR="/mnt/cpack-exercise"' >> /entrypoint.sh && \
echo 'BUILD_DIR="/tmp/build"' >> /entrypoint.sh && \
echo 'if [ ! -d "$SOURCE_DIR" ]; then' >> /entrypoint.sh && \
echo ' echo "Error: Source directory $SOURCE_DIR not found. Did you mount the volume?"' >> /entrypoint.sh && \
echo ' exit 1' >> /entrypoint.sh && \
echo 'fi' >> /entrypoint.sh && \
echo 'echo "Setting up build environment..."' >> /entrypoint.sh && \
echo 'mkdir -p "$BUILD_DIR"' >> /entrypoint.sh && \
echo 'rsync -av --exclude "build" "$SOURCE_DIR/" "$BUILD_DIR/"' >> /entrypoint.sh && \
echo 'cd "$BUILD_DIR"' >> /entrypoint.sh && \
echo 'echo "Configuring project..."' >> /entrypoint.sh && \
echo 'cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .' >> /entrypoint.sh && \
echo 'echo "Building project..."' >> /entrypoint.sh && \
echo 'cmake --build build' >> /entrypoint.sh && \
echo 'echo "Creating packages..."' >> /entrypoint.sh && \
echo 'cd build' >> /entrypoint.sh && \
echo 'cpack -G TGZ' >> /entrypoint.sh && \
echo 'cpack -G DEB' >> /entrypoint.sh && \
echo 'echo "Copying packages to host..."' >> /entrypoint.sh && \
echo 'cp *.tar.gz "$SOURCE_DIR/"' >> /entrypoint.sh && \
echo 'cp *.deb "$SOURCE_DIR/"' >> /entrypoint.sh && \
echo 'echo "Done! Packages are available in $SOURCE_DIR"' >> /entrypoint.sh && \
chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]