Skip to content

chore: harden Dockerfiles and add devops CODEOWNERS#487

Open
mpastecki wants to merge 2 commits intomainfrom
chore/dockerfile-hardening-and-codeowners
Open

chore: harden Dockerfiles and add devops CODEOWNERS#487
mpastecki wants to merge 2 commits intomainfrom
chore/dockerfile-hardening-and-codeowners

Conversation

@mpastecki
Copy link
Copy Markdown
Contributor

Summary

  • Pin Alpine runtime packages to exact versions (Alpine 3.21)
  • Pin Debian runtime packages to exact versions (bookworm) where applicable
  • Upgrade base images to current stable (Alpine 3.21, Debian bookworm)
  • Apply hadolint best practices: SHELL pipefail, --no-cache/--no-install-recommends, shell variable quoting, merged RUN layers
  • Add CODEOWNERS rules for /.github/, /.github/CODEOWNERS, and **/Dockerfile owned by @babylonlabs-io/devops

Copilot AI review requested due to automatic review settings February 5, 2026 12:35
Copy link
Copy Markdown

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

This PR hardens the project's Dockerfile and establishes DevOps team ownership for CI/CD and container configuration files. The changes upgrade the Alpine base image from 3.16 to 3.21, pin runtime package versions for reproducibility, and add CODEOWNERS rules to ensure proper review of infrastructure-related changes.

Changes:

  • Upgraded Alpine base image from 3.16 to 3.21 in the runtime stage
  • Pinned runtime packages (bash, curl, jq) to exact versions for Alpine 3.21
  • Added hadolint ignore directive for build-time package installations
  • Added CODEOWNERS entries for the DevOps team covering .github/, CODEOWNERS itself, and all Dockerfiles

Reviewed changes

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

File Description
contrib/images/staking-api-service/Dockerfile Upgraded Alpine base image to 3.21, pinned runtime package versions, and added hadolint ignore for builder stage
.github/CODEOWNERS Added DevOps team ownership for CI/CD directories and Dockerfiles

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Final minimal image with binary only
FROM alpine:3.16 AS run
FROM alpine:3.21 AS run

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

According to the PR description, this change aims to apply hadolint best practices including the SHELL pipefail directive. However, the SHELL directive with pipefail is missing from the runtime stage. Consider adding SHELL ["/bin/sh", "-o", "pipefail", "-c"] before the RUN commands to ensure pipefail is enabled for safer script execution.

Suggested change
SHELL ["/bin/sh", "-o", "pipefail", "-c"]

Copilot uses AI. Check for mistakes.

# DevOps team owns CI/CD and container configuration
/.github/ @babylonlabs-io/devops
/.github/CODEOWNERS @babylonlabs-io/devops
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The CODEOWNERS rule /.github/CODEOWNERS @babylonlabs-io/devops creates a circular ownership pattern where the CODEOWNERS file itself is owned by devops, potentially conflicting with or duplicating the rule on line 4 that already assigns /.github/ to devops. This line appears redundant since /.github/ ownership already covers this file. Consider removing this line to avoid confusion.

Suggested change
/.github/CODEOWNERS @babylonlabs-io/devops

Copilot uses AI. Check for mistakes.

RUN addgroup --gid 1138 -S staking-api-service && adduser --uid 1138 -S staking-api-service -G staking-api-service
RUN apk add bash curl jq
RUN apk add --no-cache bash=5.2.37-r0 curl=8.14.1-r2 jq=1.7.1-r0
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The PR description mentions "Pin Debian runtime packages to exact versions (bookworm) where applicable" but no Debian-based Dockerfiles are present in the repository or modified in this PR. Only Alpine-based Dockerfiles exist. Consider updating the PR description to accurately reflect that only Alpine packages are being pinned, or clarify what "where applicable" means in this context.

Copilot uses AI. Check for mistakes.
@@ -2,6 +2,7 @@ FROM golang:1.24.11-alpine AS builder

ARG VERSION="HEAD"

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

A hadolint ignore directive for DL3018 (pin versions in apk add) has been added to the builder stage, which contradicts the PR's goal of hardening Dockerfiles by pinning package versions. While build tools often don't need pinned versions since the image is ephemeral, for consistency with the runtime stage and the PR's stated objectives, consider either pinning these build dependencies or adding a comment explaining why pinning is not necessary for the builder stage.

Suggested change
# Builder image is ephemeral and not shipped to production; build tools are intentionally left
# unpinned here to simplify maintenance. DL3018 is ignored only for this builder stage.

Copilot uses AI. Check for mistakes.
kirugan
kirugan previously approved these changes Feb 5, 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