- Fork the repository: https://github.com/cdisc-org/cdisc-rules-engine
- The workflow file
.github/workflows/build-version.ymlis already included in the main repository. It is contained within our .gitignore so you can customize it as you see fit.
- Go to the top bar of the fork, click Settings > Security > Secrets and Variables > Actions
- Click New Repository Secret and set an action secret named CDISC_LIBRARY_API_KEY and secret as your API key
- Go to Actions tab in your forked repository
- Click "Build Custom Executable"
- Click Run workflow
- Download the artifact when complete
To run builds automatically, uncomment the schedule section in the workflow:
schedule:
- cron: "0 2 * * 0" # Weekly on Sunday at 2 AM UTC
# OR
- cron: "0 2 * * *" # Daily at 2 AM UTCYou can build executables for different operating systems using GitHub's hosted runners. This creates platform-specific executables that work on different environments. See:
- https://docs.github.com/en/actions/concepts/runners/github-hosted-runners
- https://github.com/actions/runner-images
The runner in our workflow currently builds for ubuntu-22.04 but this can be changed to your particular OS, as well as CPU architectures (This will be different for Apple M chips that use ARM architecture versus Intel chips)
- Docker Desktop installed and running
- Git
- Note: There is no official support for a macOS docker runner; Windows also requires some additional setup
- Note: You will need to run Windows Command Prompt / Windows Powershell as administrator. This can be done by right clicking and the application and selecting 'Run as Administrator'
git clone https://github.com/cdisc-org/cdisc-rules-engine.git
cd cdisc-rules-engineWhen you clone the repo initially, it will come with an updated cache and main branch. Before subsequent local docker builds, you will want to follow the README to install the compatible python version of engine, create the virtual environment, and then update the cache as well as pulling down changes from main in cdisc-rules-engine root directory.
# Set up upstream remote (only done once)
git remote add upstream https://github.com/cdisc-org/cdisc-rules-engine.git
# Pull latest changes from upstream main branch
git pull upstream main# Build the executable
docker build -f Dockerfile.build -t cdisc-builder .
# Extract the executable and remove container
mkdir -p ./build-output
CONTAINER_ID=$(docker create cdisc-builder)
docker cp $CONTAINER_ID:/app/dist/output/core-ubuntu-22.04/core ./build-output/
docker rm $CONTAINER_ID
# Make executable (Linux/macOS only)
chmod +x ./build-output/core
echo "Executable ready: ./build-output/core"REM Build the executable
docker build -f Dockerfile.build -t cdisc-builder .
REM Create container and get ID
docker create cdisc-builder > temp_id.txt
set /p CONTAINER_ID=<temp_id.txt
REM Extract the executable
if not exist "build-output" mkdir build-output
docker cp %CONTAINER_ID%:/app/dist/output/core-ubuntu-22.04/core ./build-output/
REM Clean up
docker rm %CONTAINER_ID%
del temp_id.txt
echo Executable ready: ./build-output/core# Build the executable
docker build -f Dockerfile.build -t cdisc-builder .
# Extract the executable and remove container
New-Item -ItemType Directory -Force -Path ./build-output
$CONTAINER_ID = docker create cdisc-builder
docker cp "${CONTAINER_ID}:/app/dist/output/core-ubuntu-22.04/core" ./build-output/
docker rm $CONTAINER_IDThe default Dockerfile builds for Ubuntu 22.04 on AMD64 architecture. To customize for your specific environment, modify these sections in Dockerfile.build:
To change what underlying OS the executable is built on to match your implementation needs, you will need to edit the dockerfile
- https://docs.docker.com/reference/dockerfile/#from
- Windows: https://hub.docker.com/r/microsoft/windows
- macOS: https://hub.docker.com/search - you can explore DockerHub to find a macOS image to utilize
You will need to edit these areas of the dockerfile:
# Change the base image (line 2)
FROM --platform=linux/amd64 ubuntu:22.04
# Example:
# FROM mcr.microsoft.com/windows/servercore:ltsc2022 # WindowsIf you change the base OS, update the PyInstaller dist path. this is for clarity and organization, but it's not technically required for functionality:
# Change the --dist path in the pyinstaller command (around line 20)
--dist ./dist/output/core-ubuntu-22.04 # Current
# Examples:
# --dist ./dist/output/core-windows
# --dist ./dist/output/core-macRemember to update the corresponding path in your Docker copy command:
Linux/macOS/WSL/Git Bash:
# Update this path to match your PyInstaller dist path
docker cp $CONTAINER_ID:/app/dist/output/core-ubuntu-22.04/core ./build-output/
# Example for Windows build:
# docker cp $CONTAINER_ID:/app/dist/output/core-windows/core ./build-output/Windows Command Prompt:
REM Update this path to match your PyInstaller dist path
docker cp %CONTAINER_ID%:/app/dist/output/core-ubuntu-22.04/core ./build-output/
REM Example for Windows build:
REM docker cp %CONTAINER_ID%:/app/dist/output/core-windows/core ./build-output/Windows PowerShell:
# Update this path to match your PyInstaller dist path
docker cp "${CONTAINER_ID}:/app/dist/output/core-ubuntu-22.04/core" ./build-output/
# Example for Windows build:
# docker cp "${CONTAINER_ID}:/app/dist/output/core-windows/core" ./build-output/Currently the Dockerfile.build is ubuntu and we give the file executable permissions. This may not be required depending on your OS.
RUN chmod +x /app/dist/output/core-ubuntu-22.04/core/core && \- Recommended: Use WSL (Windows Subsystem for Linux) or Git Bash for the best experience with the bash commands
- The
chmod +xcommand is not needed on Windows as executable permissions work differently - If using Command Prompt, some syntax differs from bash (variable assignment, echo commands)
- The bash commands should work directly in your terminal
- Make sure Docker Desktop is running before executing the commands
- The
chmod +xstep is required to make the executable runnable
For the most consistent experience across all platforms, consider using the GitHub Actions approach (Option 1), which handles platform differences automatically and doesn't require local Docker setup.