Skip to content

Refactor Dockerfiles, enhance GHCR CI workflow, and update README#289

Draft
watal wants to merge 9 commits into
developfrom
build/docker-refactor
Draft

Refactor Dockerfiles, enhance GHCR CI workflow, and update README#289
watal wants to merge 9 commits into
developfrom
build/docker-refactor

Conversation

@watal
Copy link
Copy Markdown
Member

@watal watal commented Feb 25, 2026

Description

Refactored Dockerfiles to adopt a multi-stage build and a minimal runtime image.

Enhanced the GHCR GitHub Actions workflow by adding:

  • Matrix builds (prod/dev)
  • Multi-platform images (amd64/arm64)
  • SBOM generation
  • Provenance attestation
  • Cosign image signing

Updated README and example configurations to reflect the new image usage and local build instructions.

Type of change

  • New features
  • Bug fixes
  • Refactoring
  • Documentation updates

Motivation and Context

This change improves:

  • Docker image size and security via multi-stage builds
  • Supply chain security with SBOM, provenance, and cosign signing

How is This Tested?

  • scenario tests (test/)
  • examples/tinet/sr-mpls_explicit-path_l3vpn
  • examples/containerlab/srv6_te_l3vpn
  • examples/containerlab/sr-mpls_explicit-path

@watal watal changed the base branch from main to develop February 25, 2026 00:32
@watal watal requested a review from Copilot February 25, 2026 00:32
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

This PR refactors the Docker build infrastructure to improve security and supply chain transparency. It introduces multi-stage builds for smaller production images, separates production and development images, and enhances the CI/CD pipeline with multi-platform builds, SBOM generation, provenance attestation, and Cosign image signing.

Changes:

  • Refactored Dockerfiles to use multi-stage builds (production) and separate development images with distinct tagging schemes (latest vs latest-dev)
  • Enhanced GitHub Actions workflow with matrix builds for prod/dev variants, multi-platform support (amd64/arm64), and security features (SBOM, provenance, Cosign signing)
  • Updated examples and documentation to reflect new image tags and build instructions

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
build/package/Dockerfile Refactored to multi-stage build with debian:bookworm-slim runtime for minimal production image
build/package/Dockerfile.dev New development Dockerfile with full toolchain and debugging utilities
.github/workflows/ghcr.yml Enhanced workflow with matrix builds, multi-platform support, SBOM, provenance, and Cosign signing
build/package/README.md Updated documentation with separate instructions for published vs locally-built images
examples/tinet/sr-mpls_explicit-path_l3vpn/spec.yaml Updated to use latest-dev tag for local development builds
examples/containerlab/srv6_explicit-path_l3vpn/srv6_te_l3vpn.clab.yml Updated to use latest-dev tag from GHCR
examples/containerlab/sr-mpls_explicit-path/sr-mpls_pcep.clab.yml Updated to use latest-dev tag from GHCR

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

Comment thread build/package/Dockerfile
Comment thread .github/workflows/ghcr.yml
Comment thread build/package/Dockerfile.dev Outdated
Comment thread examples/tinet/sr-mpls_explicit-path_l3vpn/spec.yaml Outdated
Comment thread build/package/README.md
Comment thread .github/workflows/ghcr.yml
Comment thread build/package/Dockerfile.dev
Comment thread build/package/Dockerfile Outdated
Comment thread .github/workflows/ghcr.yml
@watal watal force-pushed the build/docker-refactor branch 2 times, most recently from 487be09 to 61f990b Compare February 25, 2026 01:10
@watal watal requested a review from Copilot February 26, 2026 04:16
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

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


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

@watal watal force-pushed the build/docker-refactor branch from bcf444b to 60d0252 Compare February 26, 2026 06:27
@watal watal changed the base branch from develop to update/go1.26.0 February 26, 2026 06:27
@watal watal requested a review from Copilot February 26, 2026 06:30
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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.


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

Comment thread build/package/README.md
Comment on lines +35 to +36
LOGDIR="$(pwd)/logs"
mkdir -p "$LOGDIR"
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The LOGDIR is set to an absolute path "/var/log/pola" in the original version but changed to a relative path "$(pwd)/logs" in the new version. While the new version is more portable and doesn't require root permissions, this is a significant behavioral change. Users upgrading from the old instructions will have logs in a different location. Consider documenting this change or providing a note about log directory location.

Copilot uses AI. Check for mistakes.
Comment thread build/package/README.md
Comment on lines +43 to +49
# Start the container
docker run -d --network host \
-v "$(pwd)/$MOUNTDIR:/$MOUNTDIR" \
-v "$LOGDIR:$LOGDIR" \
-w "/$MOUNTDIR" \
ghcr.io/nttcom/pola:latest \
polad -f polad.yaml
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The docker run command uses '-d' (detach mode) instead of the original '-itd' (interactive, TTY, detach). This change is appropriate since polad runs as a daemon and doesn't need an interactive TTY. However, this means users cannot easily attach to the container for debugging. Consider documenting how to access the container for debugging purposes (e.g., using 'docker exec').

Copilot uses AI. Check for mistakes.
pola-pce:
kind: linux
image: ghcr.io/nttcom/pola:latest
image: ghcr.io/nttcom/pola:latest-dev
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The containerlab configuration uses the latest-dev image which has 'polad' as the ENTRYPOINT (as defined in Dockerfile.dev). However, the configuration doesn't specify a 'cmd' or override the entrypoint. The container will start with 'polad -f polad.yaml' by default, but the default working directory and the location of polad.yaml may not align. Consider adding a 'cmd' field to specify the correct path to the configuration file, or verify that the default CMD arguments work correctly with the bind mount at '/polad.yaml'.

Suggested change
image: ghcr.io/nttcom/pola:latest-dev
image: ghcr.io/nttcom/pola:latest-dev
cmd: ["-f", "/polad.yaml"]

Copilot uses AI. Check for mistakes.
pola-pce:
kind: linux
image: ghcr.io/nttcom/pola:latest
image: ghcr.io/nttcom/pola:latest-dev
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The containerlab configuration uses the latest-dev image which has 'polad' as the ENTRYPOINT (as defined in Dockerfile.dev). However, the configuration doesn't specify a 'cmd' or override the entrypoint. The container will start with 'polad -f polad.yaml' by default, but the default working directory and the location of polad.yaml may not align. Consider adding a 'cmd' field to specify the correct path to the configuration file, or verify that the default CMD arguments work correctly with the bind mount at '/polad.yaml'.

Suggested change
image: ghcr.io/nttcom/pola:latest-dev
image: ghcr.io/nttcom/pola:latest-dev
cmd: ["-f", "/polad.yaml"]

Copilot uses AI. Check for mistakes.
Comment thread build/package/README.md Outdated
Comment thread .github/workflows/ghcr.yml Outdated
@watal watal force-pushed the update/go1.26.0 branch from e5cc730 to 36a92ca Compare March 2, 2026 10:51
Base automatically changed from update/go1.26.0 to develop March 2, 2026 10:52
@watal watal force-pushed the build/docker-refactor branch 3 times, most recently from c778a8c to 71215c5 Compare April 7, 2026 08:06
@watal watal force-pushed the build/docker-refactor branch 2 times, most recently from 074703a to 18ce806 Compare May 20, 2026 01:50
@watal watal force-pushed the build/docker-refactor branch from 18ce806 to a8e5bcc Compare May 20, 2026 08:08
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.

2 participants