Shipping .NET with Docker and GitHub Actions
Maya Sharma
August 15, 2026
1 min read
1
view
(1 unique)

A small, honest pipeline: build once, test the artefact you built, and promote the same image to production.
Build once, promote everywhere
The cardinal rule of a deployment pipeline is that the artefact you tested is the artefact you ship. Everything below follows from it.
The Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish source/TechieBlog/TechieBlog.csproj -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "TechieBlog.dll"]
The workflow
name: build
on:
push:
branches: [ main ]
jobs:
container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t techieblog:${{ github.sha }} .
- run: docker run --rm techieblog:${{ github.sha }} --version
Things worth doing early
- Tag images with the commit SHA, never with
latest. - Run migrations from the application at startup, so a rollback of the image is a rollback of the schema expectation too.
- Keep secrets in the platform's secret store; a connection string in an environment file will eventually be committed.
- Fail the build on a failing smoke test, not on a warning count.
A pipeline nobody trusts gets bypassed. Make it fast enough that bypassing it is never tempting.
Rate this article
4.5
· 2 ratings
One rating per email — no sign-in needed
MS
Maya Sharma
Author of this post.
More Posts
Technology
The Markdown Kitchen Sink
Programming
Reading PostgreSQL Query Plans
Comments (0)
No comments yet
Be the first to share your thoughts on this post.
Leave a comment
No account needed — just your name and email.
Your email is never published — it is used only for confirmation and moderation.
First time here?
We will email you a one-time confirmation link. Your comment is published only
after you click it — and only after moderation. Verify once and future comments
from the same address skip this step.
Comments appear after email confirmation and moderation.