Skip to content

Commit 6e1b60a

Browse files
Trying the docker actions.
1 parent 3963ac2 commit 6e1b60a

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

.github/actions/build-libraries/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,22 @@ runs:
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: 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

src/server/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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"]

src/server/host/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ SuppliersApi__Letters=true \
44
SuppliersApi__Data=true \
55
SuppliersApi__Assemblies__0="nhs.notify.suppliers.api.letter" \
66
SuppliersApi__Assemblies__1="nhs.notify.suppliers.api.data" \
7+
ASPNETCORE_ENVIRONMENT="Development" \
78
dotnet nhs.notify.suppliers.api.host.dll

0 commit comments

Comments
 (0)