Skip to content

Add Alpine-based container image variants#5051

Merged
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:alpine-image
Jun 12, 2025
Merged

Add Alpine-based container image variants#5051
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:alpine-image

Conversation

@nscuro
Copy link
Copy Markdown
Member

@nscuro nscuro commented Jun 12, 2025

Description

Adds Alpine-based container image variants.

The new variants will be published in addition to the existing variant. Given enough positive user feedback, we may deprecate the Debian-based variants. Until then, Alpine variants are to be considered experimental.

Note that DT v5 has already switched to exclusively Alpine base images: DependencyTrack/hyades-apiserver#1206

New image variants are distinguished by a -alpine suffix in the tag, e.g.:

  • dependencytrack/apiserver:latest-alpine
  • dependencytrack/apiserver:4.14.0-alpine
  • dependencytrack/apiserver:snapshot-alpine

The new images further use jdeps and jlink to create a minimal JRE, with only those Java modules DT needs.

As a result, -alpine images are about 200MB smaller than their Debian counterparts.

Addressed Issue

N/A

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@nscuro nscuro added this to the 4.14.0 milestone Jun 12, 2025
@nscuro nscuro added the enhancement New feature or request label Jun 12, 2025
@owasp-dt-bot
Copy link
Copy Markdown

owasp-dt-bot commented Jun 12, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

The new variants will be published *in addition* to the existing variant. Given enough positive user feedback, we may deprecate the Debian-based variants. Until then, Alpine variants are to be considered experimental.

Note that DT v5 has already switched to exclusively Alpine base images: DependencyTrack/hyades-apiserver#1206

New image variants are distinguished by a `-alpine` suffix in the tag, e.g.:
    * dependencytrack/apiserver:latest-alpine
    * dependencytrack/apiserver:4.14.0-alpine
    * dependencytrack/apiserver:snapshot-alpine

The new images further use `jdeps` and `jlink` to create a minimal JRE, with only those Java modules DT needs.

As a result, `-alpine` images are about 200MB smaller than their Debian counterparts.

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro marked this pull request as ready for review June 12, 2025 17:59
Copilot AI review requested due to automatic review settings June 12, 2025 17:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds experimental Alpine-based container image variants that use jdeps/jlink to produce a minimal JRE and are ~200 MB smaller than the Debian images.

  • Introduces Dockerfile.alpine for building Alpine-based images.
  • Updates the existing Debian Dockerfile header and argument placement.
  • Extends the CI workflow to build, tag, and push -alpine variants.

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/main/docker/Dockerfile.alpine New multi-stage Alpine Dockerfile for minimal JRE.
src/main/docker/Dockerfile Added header/license block and reorganized ARG/FROM.
.github/workflows/_meta-build.yaml Added tags and build step for Alpine image variants.
Files not reviewed (2)
  • .idea/runConfigurations/Build_API_Server_Image__Alpine_.xml: Language not supported
  • .idea/runConfigurations/Build_Bundled_Image__Alpine_.xml: Language not supported
Comments suppressed due to low confidence (2)

.github/workflows/_meta-build.yaml:141

  • Add if: ${{ inputs.publish-container }} to this step to mirror the Debian build and avoid unnecessary builds when images aren’t being published.
- name: Build Alpine multi-arch Container Image

.github/workflows/_meta-build.yaml:112

  • [nitpick] Using tags-alpine as an output name with a hyphen can be error-prone in GitHub Actions. Consider renaming to tags_alpine for consistency and safer referencing.
TAGS_ALPINE=""

@codacy-production
Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 7112c721 (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7112c72) Report Missing Report Missing Report Missing
Head commit (6da5a26) 24042 19400 80.69%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5051) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@nscuro nscuro merged commit 9427d40 into DependencyTrack:master Jun 12, 2025
10 checks passed
@nscuro nscuro deleted the alpine-image branch June 12, 2025 18:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants