Skip to content

Updates for Dockerfile templates#1616

Closed
erinyoung wants to merge 55 commits into
StaPH-B:masterfrom
erinyoung:master
Closed

Updates for Dockerfile templates#1616
erinyoung wants to merge 55 commits into
StaPH-B:masterfrom
erinyoung:master

Conversation

@erinyoung

Copy link
Copy Markdown
Contributor

This PR contains

  1. New dockerfile templates.
    a. The templates include a CMD line, new labels, creation of a non-root user, and other updates.
    b. There's a LOT more of them for images built in rust, R, and java
  2. Updated github actions for these new files.
    a. Build to test is now split into three sections to assist in code review : builder (optional), app, and test
    b. Adjusted for new labels
    c. Explicit testing for nextflow deps
    d. Added linting and security testing (set up to be ignored right now)
    e. Created a bot to assist in comparing two files

erinyoung added 30 commits April 7, 2026 10:41
Updated Docker build workflow to include checks for builder stage and validate image properties.
Add permissions for pull requests and contents.
Added validation steps for metadata labels, working directory, non-root user, and Nextflow dependencies. Included a report generation step to summarize validation results and image sizes.
Updated Hadolint action version and improved error messages for various checks in the Dockerfile linting workflow.
Add workflow_dispatch support for Dockerfile changes
Added has_changes output to detect-changes job and updated logic for handling changes in pull requests.
Add validation step for Nextflow dependencies in Dockerfile workflow.
Updated Hadolint configuration to ignore additional linting rules and enabled continue-on-error for several checks.
Updated validation steps to check for additional Nextflow dependencies and added error handling for missing utilities.
Added DL3047 to the list of ignored Hadolint checks.
Reduced the ignored linting rules in the Dockerfile linting workflow.
Updated cache scope to include version and modified image size reporting to list built images.
Updated the bot's trigger conditions and parameter extraction logic.
Refactor matrix generation logic to use PR_FILES environment variable for transforming PR file list into JSON structure.
Updated the workflow to handle escaped quotes in PR file input and renamed the environment variable for clarity.
Updated workflow to push images to both Docker Hub and Quay. Adjusted cache requirements and improved README update steps.
Removed 'dockerfile.version' from required labels in the workflow.
Refactor Dockerfile to streamline build stages and improve clarity.
Updated Dockerfile template with improved comments and structure.
Updated README with additional details on installed tools and usage instructions.
Updated metadata labels in Dockerfile for better clarity and compliance with OCI Image Spec.
Updated metadata labels in Dockerfile to reflect new base image and additional information.
@erinyoung

Copy link
Copy Markdown
Contributor Author

Closes #1615
Closes #750
Closes #1249
Attempt at #1600

Comment thread dockerfile-template/Dockerfile Outdated
# The date this image was last updated (Manually update this!)
org.opencontainers.image.created="2024-05-20" \
# The exact base image used for the 'app' stage (Must match the FROM instruction above)
org.opencontainers.image.base.name="ubuntu:jammy" \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ubuntu:noble

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like most of the org.opencontainer.image.base.name were incorrect. I think they are all fixed now.

@erinyoung

Copy link
Copy Markdown
Contributor Author

This is what these look like in action: erinyoung#8

@Kincekara

Copy link
Copy Markdown
Collaborator

This is what these look like in action: erinyoung#8

oh, that's awesome!

IMAGE="${{ inputs.tool_name }}:app"

FAILED=0
if docker run --rm $IMAGE ps --version > /dev/null 2>&1; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

for this line and similar lines below, would it be helpful to remove /dev/null 2>&1? Just thinking that it might be useful to see that output in the github actions log in case we need to see the error message (or conversely, see the version of ps, sed, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The error has to be routed to stdout instead of stderr, or the step fails at docker run --rm $IMAGE ps --version and won't continue on.

# Where users can find instructions or manuals for the software
org.opencontainers.image.documentation="https://github.com/StaPH-B/docker-builds" \
# Link to the source code used to build the image (which is often a GitHub url)
org.opencontainers.image.source="https://github.com/StaPH-B/docker-builds" \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

reminder to double-check that this label org.opencontainers.image.source as well as the label org.opencontainers.image.url are accurate

If one of them will always link back to this github repo, we should state that in the comment so users know to keep it static

@@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just curious - what does this comment line do? Is there a meaning behind this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can remove this if we want to. Our Dockerfiles are pretty basic.

This tells Docker which parser/feature set to use when reading the Dockerfile, specifically it instructs Docker to use the BuildKit Dockerfile frontend (docker/dockerfile). The :1 means version 1 of that syntax.

It must appear at the very top of the Dockerfile before any other instructions.

I am not clear about all the features of using this line, but it enables modern Dockerfile features that aren’t available in the legacy parser, such as - RUN --mount=type=cache.

There's supposed to be improved performance with BuildKit.

@erinyoung erinyoung marked this pull request as draft April 16, 2026 17:14
@erinyoung erinyoung marked this pull request as draft April 16, 2026 17:14
@erinyoung

Copy link
Copy Markdown
Contributor Author

This PR was too large and had too many steps and ideas.

I have split it into several PR:
#1616
#1652
#1653

@erinyoung erinyoung closed this Apr 21, 2026
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