-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add devops for new Person API (#551)
* Basic dockerfile for serving the Person API * Custom entrypoint script that does not run any EF migrations * Add new Person Api Dockerfile to build test * Add new Project to .NET CI tests * Fix: target correct project during build * CI: Test both Dockerfiles
- Loading branch information
1 parent
2e2ad31
commit d5b4427
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build | ||
WORKDIR /build | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY . . | ||
|
||
RUN --mount=type=secret,id=github_token dotnet nuget add source --username USERNAME --password $(cat /run/secrets/github_token) --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json" | ||
RUN dotnet build -c Release PersonsApi | ||
RUN dotnet publish PersonsApi -c Release -o /app --no-restore | ||
|
||
RUN dotnet new tool-manifest | ||
RUN dotnet tool install dotnet-ef --version 8.0.7 | ||
ENV PATH="$PATH:/root/.dotnet/tools" | ||
|
||
ARG ASPNET_IMAGE_TAG | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS final | ||
|
||
RUN apt-get update | ||
RUN apt-get install unixodbc curl gnupg -y | ||
RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg | ||
RUN curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/msprod.list | ||
RUN apt-get update | ||
RUN ACCEPT_EULA=Y apt-get install msodbcsql18 mssql-tools18 -y | ||
|
||
COPY --from=build /app /app | ||
|
||
WORKDIR /app | ||
COPY ./script/personsapi.docker-entrypoint.sh ./docker-entrypoint.sh | ||
RUN chmod +x ./docker-entrypoint.sh | ||
|
||
ENV ASPNETCORE_HTTP_PORTS 80 | ||
EXPOSE 80/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# exit on failures | ||
set -e | ||
set -o pipefail | ||
|
||
exec "$@" |