File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5151 path : " src/server/host/bin/Release"
5252 name : libs-host-${{ inputs.version }}
5353 include-hidden-files : true
54+
55+ - name : Set up Docker Buildx
56+ uses : docker/setup-buildx-action@v3
57+
58+ - name : Build and export
59+ uses : docker/build-push-action@v6
60+ with :
61+ context : src/server
62+ file : src/server/Dockerfile
63+ tags : |
64+ ghcr.io/nhsdigital/libshostdocker:latest
65+ # ghcr.io/nhsdigital/libshostdocker:${{ inputs.version }}
66+ outputs : type=docker,dest=${{ runner.temp }}/myimage.tar
67+
68+ - name : Upload artifact
69+ uses : actions/upload-artifact@v4
70+ with :
71+ name : libs-host-docker-${{ inputs.version }}
72+ path : ${{ runner.temp }}/myimage.tar
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ jobs:
200200 asset_content_type : " application/gzip"
201201
202202
203- # ## PUBLISH DOCKER
203+ # ## PUBLISH DOCKER - THIS NEEDS CHANGING TO DO THE DOCKER BUILD IN THE BUILD STAGE AND ARTIFACT IT. SEE publishlibhostdocker below how how and the buildlibs action.
204204 publishdocker :
205205 name : " Publish docker packages"
206206 runs-on : ubuntu-latest
@@ -224,7 +224,6 @@ jobs:
224224 docker build . -t ghcr.io/nhsdigital/nhsnotifysupplierserver:latest
225225 echo $CR_PAT | docker login ghcr.io -u nhs-notify-supplier-api --password-stdin
226226 docker push ghcr.io/nhsdigital/nhsnotifysupplierserver:latest
227-
228227 env:
229228 CR_PAT: ${{ secrets.GITHUB_TOKEN }}
230229
@@ -582,3 +581,28 @@ jobs:
582581 env:
583582 TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
584583 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
584+
585+
586+
587+ # ## PUBLISH LIBS host docker
588+ publishlibhostdocker :
589+ name : " Publish libs host docker"
590+ runs-on : ubuntu-latest
591+ needs : [publish]
592+ permissions :
593+ packages : write
594+ contents : read
595+ steps :
596+ - name : " Get the artefacts"
597+ uses : actions/download-artifact@v4
598+ with :
599+ path : .
600+ name : libs-host-docker-${{ inputs.version }}
601+
602+ - run : |
603+ docker load --input ${{ runner.temp }}/myimage.tar
604+ docker image ls -a
605+ echo $CR_PAT | docker login ghcr.io -u nhs-notify-supplier-api --password-stdin
606+ docker push ghcr.io/nhsdigital/libshostdocker:latest
607+ env:
608+ CR_PAT: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ # Multi-stage Dockerfile for .NET 8 Web API
2+ # Build stage
3+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
4+ WORKDIR /src
5+
6+ # Copy solution and restore as distinct layers
7+ COPY .version ./
8+ COPY build.sh ./
9+ COPY server.sln ./
10+ COPY host/host.csproj ./host/
11+ COPY abstractions/abstractions.csproj ./abstractions/
12+ COPY data/data.csproj ./data/
13+ COPY letter/letter.csproj ./letter/
14+ COPY . .
15+
16+ RUN ./build.sh
17+
18+ # Runtime stage
19+ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
20+ WORKDIR /app
21+ COPY --from=build src/host/bin/Release/net8.0/publish .
22+
23+ # Expose port (change if your app uses a different port)
24+ EXPOSE 8080
25+
26+ # Set environment variables (optional)
27+ # ENV ASPNETCORE_URLS=http://+:80
28+ RUN ls -la
29+
30+ ENTRYPOINT ["./run.sh" ]
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ SuppliersApi__Letters=true \
44SuppliersApi__Data=true \
55SuppliersApi__Assemblies__0=" nhs.notify.suppliers.api.letter" \
66SuppliersApi__Assemblies__1=" nhs.notify.suppliers.api.data" \
7+ ASPNETCORE_ENVIRONMENT=" Development" \
78dotnet nhs.notify.suppliers.api.host.dll
You can’t perform that action at this time.
0 commit comments