-
Notifications
You must be signed in to change notification settings - Fork 5
Development setup script and analogous Dockerfile
#36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6f0e643
c4abbb2
009f695
67b9fdc
8912584
45d7ae9
b7561f9
05c27d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /build | ||
| /build.log | ||
| /venv |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||
| # Dockerfile for building Cetmodules development image. | ||||||
|
|
||||||
| # Podman instructions for building and uploading tagged images: | ||||||
| # $ DATE="$(date +"%Y-%m-%d")" | ||||||
| # $ podman build --tag cetmodules-dev:$DATE . | ||||||
| # $ podman login ghcr.io --username <username> -p $(gh auth token) | ||||||
| # $ podman push cetmodules-dev:$DATE ghcr.io/fnalssi/cetmodules-dev:$DATE | ||||||
| # ... and optionally push with destination tag "latest" | ||||||
|
|
||||||
| # Base image | ||||||
| FROM ubuntu:latest | ||||||
|
||||||
| FROM ubuntu:latest | |
| FROM ubuntu:22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This is not a production container; it is a development container.
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --break-system-packages flag bypasses Python's externally-managed-environment protection. This is a security and maintainability risk. Consider using a virtual environment inside the container or using the OS package manager's Python packages instead. For example:
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install --no-cache-dir cmake sphinx ...
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Catch2 repository is cloned without specifying a version or tag, which means the build will use whatever is on the default branch at the time. This could introduce breaking changes or incompatibilities. Consider pinning to a specific release tag for reproducibility:
RUN git clone --branch v3.5.2 --depth 1 https://github.com/catchorg/Catch2.git /tmp/Catch2 && \| RUN git clone https://github.com/catchorg/Catch2.git /tmp/Catch2 && \ | |
| RUN git clone --branch v3.5.2 --depth 1 https://github.com/catchorg/Catch2.git /tmp/Catch2 && \ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||
| # Cetmodules Development Container | ||||||
|
||||||
| # Cetmodules Development Container | |
| # cetmodules Development Container |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Exit immediately if a command exits with a non-zero status. | ||||||||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # --- OS Detection --- | ||||||||||||||||||||||||||||||||||||||||||
| if [ -f /etc/os-release ]; then | ||||||||||||||||||||||||||||||||||||||||||
| . /etc/os-release | ||||||||||||||||||||||||||||||||||||||||||
| if [[ "$ID" == "ubuntu" ]]; then | ||||||||||||||||||||||||||||||||||||||||||
| PACKAGE_MANAGER="apt-get" | ||||||||||||||||||||||||||||||||||||||||||
| BUILD_DEPS="build-essential" | ||||||||||||||||||||||||||||||||||||||||||
| elif [[ "$ID" == "almalinux" ]]; then | ||||||||||||||||||||||||||||||||||||||||||
| PACKAGE_MANAGER="dnf" | ||||||||||||||||||||||||||||||||||||||||||
| BUILD_DEPS="gcc-c++" | ||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||
| echo "Unsupported operating system: $ID" | ||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||
| echo "/etc/os-release not found. Cannot determine operating system." | ||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # --- System Dependency Installation --- | ||||||||||||||||||||||||||||||||||||||||||
| echo "Updating package lists..." | ||||||||||||||||||||||||||||||||||||||||||
| sudo $PACKAGE_MANAGER update -y | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| echo "Installing system dependencies..." | ||||||||||||||||||||||||||||||||||||||||||
| sudo $PACKAGE_MANAGER install -y git doxygen graphviz python3-venv $BUILD_DEPS | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # --- Python Environment Setup --- | ||||||||||||||||||||||||||||||||||||||||||
| echo "Setting up Python virtual environment..." | ||||||||||||||||||||||||||||||||||||||||||
| python3 -m venv venv | ||||||||||||||||||||||||||||||||||||||||||
| source venv/bin/activate | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| echo "Installing Python packages (CMake, Sphinx, etc.)..." | ||||||||||||||||||||||||||||||||||||||||||
| pip install cmake sphinx sphinxcontrib-moderncmakedomain sphinx-design sphinx-toolbox sphinxcontrib-jquery | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # --- Catch2 Installation --- | ||||||||||||||||||||||||||||||||||||||||||
| echo "Cloning and installing Catch2..." | ||||||||||||||||||||||||||||||||||||||||||
| git clone https://github.com/catchorg/Catch2.git | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
| git clone https://github.com/catchorg/Catch2.git | |
| git clone --branch v3.5.2 --depth 1 https://github.com/catchorg/Catch2.git |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script changes directory to cetmodules but never changes back. If the script is sourced instead of executed, this will leave the user in an unexpected directory. Consider adding cd .. at the end or wrapping the cetmodules operations in a subshell.
| cd cetmodules | |
| cmake -S . -B build -DBUILD_DOCS=ON | |
| cmake --build build | |
| ctest --test-dir build | |
| # --- Documentation Build --- | |
| echo "Building cetmodules documentation..." | |
| cmake --build build --target doc-cetmodules-reference | |
| cd .. | |
| ( | |
| # Enter cetmodules directory in a subshell to avoid affecting user's shell if sourced | |
| cd cetmodules | |
| cmake -S . -B build -DBUILD_DOCS=ON | |
| cmake --build build | |
| ctest --test-dir build | |
| # --- Documentation Build --- | |
| echo "Building cetmodules documentation..." | |
| cmake --build build --target doc-cetmodules-reference | |
| ) |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script clones a fresh copy of the cetmodules repository and builds it, but this doesn't align with typical development workflow. A developer running this script from the cetmodules repository would expect to build and test their current working copy, not a fresh clone from GitHub. This makes the script unsuitable for local development and testing of changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the comment: "Cetmodules" should be "cetmodules" (lowercase) to match the project's naming convention used throughout the repository and documentation.