Commit 70f0f5b 1 parent bf3cda6 commit 70f0f5b Copy full SHA for 70f0f5b
File tree 2 files changed +32
-9
lines changed
2 files changed +32
-9
lines changed Original file line number Diff line number Diff line change 32
32
33
33
- name : Build and Push Docker Image
34
34
run : |
35
- docker build -t ghcr.io/bardin08/trumpee-gateway:${{ github.event.release.tag_name}} .
35
+ docker build -t ghcr.io/bardin08/trumpee-gateway:${{ github.event.release.tag_name}} --build-arg NUGET_API_KEY=${{ secrets.SECRET_TOKEN }} .
36
36
docker tag ghcr.io/bardin08/trumpee-gateway:${{ github.event.release.tag_name}} ghcr.io/bardin08/trumpee-gateway:latest
37
37
docker push ghcr.io/bardin08/trumpee-gateway --all-tags
Original file line number Diff line number Diff line change 1
- FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build-env
2
- WORKDIR src
1
+ ARG NUGET_API_KEY
3
2
4
- COPY . .
5
- RUN dotnet restore
6
- RUN dotnet publish -c Release -o out
3
+ # STAGE 1: Build Environment
4
+ FROM mcr.microsoft.com/ dotnet/sdk:8.0-alpine AS build-env
5
+ WORKDIR /src
7
6
8
- FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
9
- COPY --from=build-env /src/out .
10
- ENTRYPOINT ["dotnet" , "./Api.dll" ]
7
+ # Copy the project files first for better layer caching (if only code changes)
8
+ COPY *.sln ./
9
+ COPY Gateway.* ./Gateway/
10
+ COPY Api.* ./Api/
11
+
12
+ # Add the custom NuGet source
13
+ RUN dotnet nuget add source https://nuget.pkg.github.com/trumpee/index.json --name github --username trumpee --password $NUGET_API_KEY --store-password-in-clear-text
14
+
15
+ # Restore NuGet packages from both sources
16
+ RUN dotnet restore Gateway.sln --source "https://api.nuget.org/v3/index.json" --source "https://nuget.pkg.github.com/trumpee/index.json"
17
+
18
+ # Build the solution
19
+ RUN dotnet build Gateway.sln -c Release
20
+
21
+ # Publish the Api project only (assuming this is the main entry point)
22
+ RUN dotnet publish ./Api/Api.csproj -c Release -o /app
23
+
24
+ # STAGE 2: Runtime Environment
25
+ FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
26
+ WORKDIR /app
27
+ COPY --from=build-env /app .
28
+
29
+ # Expose the port your application listens on (replace 80 if needed)
30
+ EXPOSE 80
31
+
32
+ # Define the entry point for your application
33
+ ENTRYPOINT ["dotnet" , "Api.dll" ]
You can’t perform that action at this time.
0 commit comments