Skip to content

feat(docker): auto-build image before DockerRun - #437

Merged
halcwb merged 2 commits into
informedica:masterfrom
7sharp9:auto-build_docker
Aug 5, 2026
Merged

feat(docker): auto-build image before DockerRun#437
halcwb merged 2 commits into
informedica:masterfrom
7sharp9:auto-build_docker

Conversation

@7sharp9

@7sharp9 7sharp9 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Extract Docker build logic into a reusable buildDockerImage function. Add dockerImageExistsLocally check to the DockerRun target so it automatically builds the image if not present locally, instead of failing with a missing image error.

Addresses #432

Extract Docker build logic into a reusable `buildDockerImage` function. Add `dockerImageExistsLocally` check to the `DockerRun` target so it automatically builds the image if not present locally, instead of failing with a missing image error.
Copilot AI lite review requested due to automatic review settings August 4, 2026 17:11
@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR extracts Docker image construction into a reusable function and makes DockerRun build the configured image when it is absent locally.

  • Preserves the root Directory.Build.props version as the Docker build argument.
  • Adds a local image inspection before running the container.
  • Reuses the extracted build function from both Docker targets.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking diagnostic issue when Docker image inspection fails for reasons other than an absent image.

The intended missing-image path builds and runs the image correctly, but all inspection failures currently enter that path and obscure the original Docker error.

Files Needing Attention: Build.fs

Important Files Changed

Filename Overview
Build.fs Extracts Docker build logic and adds automatic image creation; the new image probe conflates missing images with Docker operational failures.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  R[DockerRun] --> E[Validate required environment variables]
  E --> I[docker image inspect]
  I -->|Image exists| D[docker run]
  I -->|Nonzero exit| B[buildDockerImage]
  B --> D
Loading

Reviews (1): Last reviewed commit: "feat(docker): auto-build image before Do..." | Re-trigger Greptile

Comment thread Build.fs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the FAKE build script so DockerRun behaves more “out of the box” by automatically building the Docker image when it is missing locally, aligning with the usability goals described in issue #432.

Changes:

  • Extracted Docker build steps into a reusable buildDockerImage helper.
  • Added a dockerImageExistsLocally pre-check so DockerRun builds the image if needed.
  • Tightened parsing/validation of the <Version> value read from Directory.Build.props.

Comment thread Build.fs Outdated
Comment thread Build.fs
Update `dockerImageExistsLocally` to treat only "No such image" as a missing-image case. Any other `docker image inspect` failure (for example daemon/context/permission issues) now fails fast with the Docker error output instead of being misclassified as a first-build scenario.
Copilot AI review requested due to automatic review settings August 4, 2026 17:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Build.fs:342

  • The missing-image detection relies on matching a specific stderr substring ("No such image"), which is brittle across Docker versions (often "No such object") and locales. This can cause DockerRun to fail instead of triggering a build when the image is absent. Prefer a command that reliably indicates presence without error-text parsing (e.g., docker image ls -q <image> and check for empty stdout).
    elif result.Result.Error.Contains "No such image" then
        false
    else
        failwithf "docker image inspect failed:\n%s" result.Result.Error

@halcwb
halcwb merged commit 81ac523 into informedica:master Aug 5, 2026
4 checks passed
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.

3 participants