Skip to content

fix(docker): add curl to builder stage for utoipa-swagger-ui download#58

Merged
Rushit merged 1 commit into
mainfrom
fix/docker-builder-curl
Jul 3, 2026
Merged

fix(docker): add curl to builder stage for utoipa-swagger-ui download#58
Rushit merged 1 commit into
mainfrom
fix/docker-builder-curl

Conversation

@Rushit

@Rushit Rushit commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The Publish Docker Image workflow was failing during cargo build --release with:

failed to download Swagger UI: Custom { kind: NotFound, error: "`curl` command not found" }

Root Cause

utoipa-swagger-ui v9.0.2 downloads the Swagger UI zip from GitHub at compile time in its build.rs. It tries two methods:

  1. Rust reqwest feature → not enabled (Err(NotPresent))
  2. Falls back to the system curl binary → not present in the builder image

curl was only installed in the runtime (debian:bookworm-slim) stage, not in the builder (rust:1.90-slim) stage.

Fix

Added curl to the builder stage apt-get install.

References

Failing run: https://github.com/zvectorlabs/zradar/actions/runs/28687661442

- utoipa-swagger-ui build.rs downloads Swagger UI assets at compile time using curl as a fallback when the reqwest feature is not enabled
- curl was only present in the runtime stage, causing the Docker image build to fail on the release workflow

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds curl to the list of packages installed in the Dockerfile. The reviewer suggests using the vendored feature of utoipa-swagger-ui in Cargo.toml instead of installing curl to download Swagger UI assets at compile time, which would eliminate compile-time network requests and remove the dependency on curl in the builder stage.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Dockerfile
libssl-dev \
g++ \
protobuf-compiler \
curl \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of installing curl in the builder stage to download Swagger UI assets at compile time, consider enabling the vendored feature of utoipa-swagger-ui in your Cargo.toml (for example: utoipa-swagger-ui = { version = "9", features = ["axum", "vendored"] }). This embeds the Swagger UI assets directly, which eliminates compile-time network requests to GitHub, removes the dependency on curl in the builder stage, and enables offline/air-gapped builds.

@Rushit Rushit merged commit 0dcf367 into main Jul 3, 2026
2 of 3 checks passed
@Rushit Rushit deleted the fix/docker-builder-curl branch July 3, 2026 23:40
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.

1 participant