Skip to content

Commit

Permalink
Include version in Docker image (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
cathalnoonan authored Mar 18, 2024
1 parent 80cf6e2 commit 440f930
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ jobs:
tags: |
bagetter/bagetter:latest
bagetter/bagetter:${{ needs.version.outputs.RELEASE_VERSION }}
build-args: |
Version=${{ needs.version.outputs.RELEASE_VERSION }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ARG Version=1.0.0

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG Version
WORKDIR /src

## Create separate layer for `dotnet restore` to allow for caching; useful for local development
Expand All @@ -13,12 +16,14 @@ RUN dotnet restore BaGetter/BaGetter.csproj

## Publish app (implicitly builds the app)
FROM build AS publish
ARG Version
# copy all files
COPY /src .
RUN dotnet publish BaGetter \
--configuration Release \
--output /app \
--no-restore \
-p Version=${Version} \
-p DebugType=none \
-p DebugSymbols=false \
-p GenerateDocumentationFile=false \
Expand Down

0 comments on commit 440f930

Please sign in to comment.