Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Adds Docker support and automated container image publishing to GitHub Container Registry on main branch pushes.

Implementation

Dockerfile

  • Multi-stage build: SDK 9.0 (build) → ASP.NET Runtime 9.0 slim (runtime)
  • Non-root user (appuser) with proper file ownership
  • Health check on port 3001
  • Layer caching optimized via separate dependency restore

.dockerignore

  • Excludes build artifacts, IDE files, git/CI config, and documentation from build context

GitHub Actions Workflow (.github/workflows/docker-publish.yml)

  • Triggers: PR validation (build only), main branch push (build + publish to ghcr.io)
  • Tagging: latest, main, main-<sha>, optional semver support
  • Uses GitHub Actions cache and GITHUB_TOKEN authentication

Documentation

  • Usage examples for pulling from GHCR, local builds, and Docker Compose
  • CI/CD section updated with deployment details
  • Workflow badge added

Container Usage

docker pull ghcr.io/abeckdev/db-timetableapi-mcpserver:latest

docker run -d -p 3001:3001 \
  -e DeutscheBahnApi__ClientId="..." \
  -e DeutscheBahnApi__ApiKey="..." \
  ghcr.io/abeckdev/db-timetableapi-mcpserver:latest

Images published at ghcr.io/abeckdev/db-timetableapi-mcpserver with tags: latest, main, main-<sha>

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Docker container image and automate uploads to GitHub Container Registry</issue_title>
<issue_description>Task:

  • Create a Dockerfile for the project in the repository that builds a container image for DB-TimetableAPI-MCPServer.
  • Set up a GitHub Actions workflow that builds the Docker image whenever changes are pushed to the main branch.
  • Automate the publishing of the Docker image to the GitHub Container Registry associated with this repository upon successful builds on the main branch.

Requirements:

  • Ensure the Dockerfile is optimized for the app, including copy/install steps for all dependencies and build artifacts as appropriate.
  • Properly tag the image (preferably using the commit SHA or semantic versioning that matches repo conventions).
  • Securely use GitHub secrets for registry authentication in the workflow.
  • Document the usage and workflow in the README (overview of build, push, and usage).

Acceptance Criteria:

  • Repository contains a valid Dockerfile for the app.
  • An automated workflow (GitHub Actions) is triggered on changes to main and uploads the container to GitHub Container Registry.
  • Uploaded images are accessible and properly tagged.
  • Documentation is updated to show how the container is built, tagged, and published.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 5, 2025 23:09
Co-authored-by: abeckDev <8720854+abeckDev@users.noreply.github.com>
Co-authored-by: abeckDev <8720854+abeckDev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Docker container image and automate uploads to GitHub Container Registry Add Docker containerization with automated GHCR publishing Nov 5, 2025
Copilot AI requested a review from abeckDev November 5, 2025 23:15
@abeckDev abeckDev marked this pull request as ready for review November 6, 2025 00:27
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.89%. Comparing base (ddd38c3) to head (71ce4c2).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #9   +/-   ##
=======================================
  Coverage   72.89%   72.89%           
=======================================
  Files           5        5           
  Lines         107      107           
  Branches        5        5           
=======================================
  Hits           78       78           
  Misses         29       29           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abeckDev abeckDev merged commit b2e8003 into main Nov 6, 2025
4 checks passed
@abeckDev abeckDev deleted the copilot/add-docker-image-workflow branch November 6, 2025 00:37
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.

Add Docker container image and automate uploads to GitHub Container Registry

2 participants