From a366f96501a726365100dc0e0d94665b32461ce9 Mon Sep 17 00:00:00 2001 From: Ash Davies <3853061+DrizzlyOwl@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:30:13 +0100 Subject: [PATCH] Aspnet 8.0 (#538) * Update to debian 12 * Correctly load the GPG Key for debian 12 * Try to enforce port 80 --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d1c309fa..2a2f61fe5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN touch /app/SQL/DbMigrationScript.sql 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 restore TramsDataApi.sln RUN dotnet new tool-manifest -RUN dotnet tool install dotnet-ef --version 6.0.5 +RUN dotnet tool install dotnet-ef --version 8.0.7 ENV PATH="$PATH:/root/.dotnet/tools" RUN dotnet ef migrations script --output /app/SQL/DbMigrationScriptLegacy.sql --project TramsDataApi --context TramsDataApi.DatabaseModels.LegacyTramsDbContext --idempotent -v @@ -23,12 +23,12 @@ RUN dotnet build -c Release TramsDataApi.sln --no-restore RUN dotnet publish TramsDataApi -c Release -o /app --no-restore ARG ASPNET_IMAGE_TAG -FROM mcr.microsoft.com/dotnet/aspnet:7.0.20-bullseye-slim AS final +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 https://packages.microsoft.com/keys/microsoft.asc | apt-key add - -RUN curl https://packages.microsoft.com/config/debian/11/prod.list | tee /etc/apt/sources.list.d/msprod.list +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 @@ -37,4 +37,6 @@ COPY --from=build /app /app WORKDIR /app COPY ./script/web-docker-entrypoint.sh ./docker-entrypoint.sh RUN chmod +x ./docker-entrypoint.sh + +ENV ASPNETCORE_HTTP_PORTS 80 EXPOSE 80/tcp