Skip to content

Conversation

@rohitx01
Copy link

@rohitx01 rohitx01 commented Nov 2, 2025

Description

Consolidates duplicate Dockerfiles into a single unified version using Docker build arguments.

Addresses: #115 - Task #4 (Fresh Installation Testing)

Problem Solved

Previously maintained two separate, nearly identical Dockerfiles:

  1. Docker/Dockerfile - Standalone IVIM fitting
  2. kaapana_ivim_osipi/.../Dockerfile - Kaapana deployment

This created maintenance overhead and code duplication.

Solution

Created Docker/Dockerfile.unified with build arguments:

  • BASE_IMAGE (default: python:3.11-slim) - Specify base Docker image
  • ENV_TYPE (default: standalone) - Choose environment type

Building

Standalone (default)

docker build --build-arg ENV_TYPE=standalone
-t ivim-fitting:standalone
-f Docker/Dockerfile.unified .

Kaapana Deployment

docker build --build-arg BASE_IMAGE=local-only/base-python-cpu:latest
--build-arg ENV_TYPE=kaapana
-t ivim-fitting:kaapana
-f Docker/Dockerfile.unified .

Testing Completed

Local Testing (Docker Desktop - Windows)

  • Standalone build succeeds

  • Image ID: 75a626d42f0b

  • Size: 13.2GB

  • Entry point: python3 -m WrapImage.nifti_wrapper

  • Kaapana build succeeds (with python:3.11-slim base)

  • Image ID: f662fb55bfee

  • Size: 14GB

  • Entry point: python3 -u -m WrapImage.nifti_wrapper_kaapana

  • Both conditional logic statements work correctly

  • File copying and dependencies install without errors

  • Build scripts execute correctly

Integration Testing (Requires Kaapana Platform)

  • Runtime with actual local-only/base-python-cpu:latest base image
  • Volume mounts work (OPERATOR_IN_DIR, OPERATOR_OUT_DIR)
  • MinIO data integration
  • Airflow DAG execution in Kaapana UI
  • Workflow submission through web interface

Files Added

  • Docker/Dockerfile.unified - Unified Dockerfile
  • Docker/build-standalone.sh - Standalone build script
  • Docker/build-kaapana.sh - Kaapana build script
  • Docker/DOCKERFILE_MERGE.md - Detailed documentation

Related

Note: Testing limited to local Docker Desktop due to hardware constraints. Both image variants build successfully and are ready for integration testing in a Kaapana deployment environment.

…ask OSIPI#4)

- Create unified Dockerfile.unified supporting both standalone and Kaapana
- Add build-standalone.sh and build-kaapana.sh convenience scripts
- Document consolidation approach and testing performed
- Uses ARG for BASE_IMAGE and ENV_TYPE configuration

 Testing completed:
- Standalone build: Successfully created (13.2GB)
  Image ID: 75a626d42f0b
- Kaapana build: Successfully created (14GB)
  Image ID: f662fb55bfee
- Both images build without errors
- Conditional logic (if statements) work correctly
- Entry points properly configured for each environment

 Integration testing requires:
- Actual Kaapana base image (local-only/base-python-cpu:latest)
- Kaapana platform deployment
- Workflow execution in Kaapana UI
@rohitx01 rohitx01 mentioned this pull request Nov 2, 2025
5 tasks
@Unique-Usman
Copy link
Contributor

@etpeterson, while I take a look at this, whenever you are chanced, you can also take a look.

@etpeterson
Copy link
Contributor

I like this direction. This could also remove the old docker files.

@etpeterson
Copy link
Contributor

I also see failing docker tests.

@etpeterson
Copy link
Contributor

I looked a little more and it looks like the docker build might not entirely be your problem, but we should get it working to confirm your changes are correct.

- Refactored Dockerfile.unified to use multi-stage builds
- Eliminated conditional if statements for cleaner code flow
- Separated base, standalone, and kaapana stages
- Updated build scripts to use --target flag

Testing:
- Standalone build succeeds (13.2GB, ID: 7b877408f593)
- Kaapana build succeeds (14GB, ID: 8d8c72fbd004)
- Both images build without errors
- Multi-stage approach eliminates conditionals
- Build flow is now easier to follow
@rohitx01
Copy link
Author

Hi @etpeterson,

I've refactored the Dockerfile to use multi-stage builds as you suggested.

Changes Made

  • Converted to three-stage build: basestandalone / kaapana
  • Eliminated all conditional if statements throughout the Dockerfile
  • Each stage is now self-contained and easier to follow
  • Updated build scripts to use --target flag

New Build Commands

Standalone
docker build --target standalone -t ivim-fitting:standalone -f Docker/Dockerfile.unified .

Kaapana
docker build --target kaapana --build-arg BASE_IMAGE=local-only/base-python-cpu:latest -t ivim-fitting:kaapana -f Docker/Dockerfile.unified .

Testing Results

Both builds tested successfully on Windows Docker Desktop:

  • Standalone: 13.2GB (Image ID: 7b877408f593)
  • Kaapana: 14GB (Image ID: 8d8c72fbd004)

Questions

Regarding the failing Docker test:
The CI test appears to be running the original Docker/Dockerfile rather than Dockerfile.unified. Should I:

  1. Update the CI workflow to test the unified Dockerfile?
  2. Keep both Dockerfiles for now?

Regarding old Dockerfiles:
Should I remove Docker/Dockerfile and kaapana_ivim_osipi/.../Dockerfile in this PR, or in a follow-up after testing?

Let me know if you need any other changes!

Thanks,
Rohit
PS: Apologies for the delay, I was occupied with shifting to a new place over the last few days

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.

4 participants