From 9c4e3d5e77628d4f6e3bf493a39e5794c451cd93 Mon Sep 17 00:00:00 2001 From: Sondre Wittek Date: Wed, 8 Jan 2025 16:06:27 +0100 Subject: [PATCH 1/2] Refactor Dockerfile to streamline build process and set environment variables --- Dockerfile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95d3ee77..48e0c1b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,27 @@ # Building accessmanagement frontend FROM node:22-slim AS generate-accessmanagement-frontend -# FROM node:lts as generate-accessmanagement-frontend WORKDIR /build COPY . . -RUN corepack enable -RUN yarn --immutable -RUN yarn build +RUN corepack enable && \ + yarn --immutable && \ + yarn build # Building the backend FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS generate-accessmanagement-backend + WORKDIR /build COPY backend . -RUN dotnet build src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.csproj -c Release -o /app_output RUN dotnet publish src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.csproj -c Release -o /app_output # Building the final image FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS final -EXPOSE 80 -#EXPOSE 443 + WORKDIR /app +EXPOSE 80 + +ENV ASPNETCORE_ENVIRONMENT=Development +ENV ASPNETCORE_HTTP_PORTS=80 # ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ # DOTNET_RUNNING_IN_CONTAINER=true ENV ASPNETCORE_ENVIRONMENT = Development @@ -31,4 +33,5 @@ COPY --from=generate-accessmanagement-frontend /build/src/localizations ./wwwroo COPY --from=generate-accessmanagement-frontend /build/dist/manifest.json ./wwwroot/accessmanagement RUN mkdir /tmp/logtelemetry -ENTRYPOINT ["dotnet", "Altinn.AccessManagement.UI.dll"] + +ENTRYPOINT ["dotnet", "Altinn.AccessManagement.UI.dll"] \ No newline at end of file From f8f49ab65aa8478b9ccdf6ea0cc911f3087527da Mon Sep 17 00:00:00 2001 From: Sondre Wittek Date: Wed, 8 Jan 2025 16:20:09 +0100 Subject: [PATCH 2/2] Clean up Dockerfile by removing commented environment variable definitions --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48e0c1b2..ee76d42a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,10 +22,6 @@ EXPOSE 80 ENV ASPNETCORE_ENVIRONMENT=Development ENV ASPNETCORE_HTTP_PORTS=80 -# ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ -# DOTNET_RUNNING_IN_CONTAINER=true -ENV ASPNETCORE_ENVIRONMENT = Development -ENV ASPNETCORE_HTTP_PORTS = 80 COPY --from=generate-accessmanagement-backend /app_output . COPY --from=generate-accessmanagement-frontend /build/dist/assets ./wwwroot/accessmanagement/assets