From 88f2015e5038dcd22eab7d9efee6696758edd975 Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:02:21 +0100 Subject: [PATCH] Admin UI and Consumer API: containers run on wrong ports (#427) * fix: change ports to 80 * chore: rename Admin UI ClientApp Dockerfile to Dockerfile.debug * chore: don't set ASPNETCORE_URLS env var in docker-compose files * chore: don't set ASPNETCORE_URLS in adminui deployment * chore: set correct repo label in Challenges.Jobs.Cleanup Dockerfile * chore: set correct env variables in Dockerfile.debug * chore: try to use other builder * refactor: use new builder * chore: revert usage of other builder * fix: set env ar ASPNETCORE_URLS in all Dockerfiles * fix: replace ASPNETCORE_PORT with ASPNETCORE_URLS for ConsumerApi * chore: remove redundant ASPNETCORE_URLS from consumer api --- .ci/docker-compose.test.yml | 2 -- .../src/AdminUi/ClientApp/{Dockerfile => Dockerfile.debug} | 6 +++--- AdminUi/src/AdminUi/Dockerfile | 5 ++++- AdminUi/src/AdminUi/Dockerfile.debug | 2 ++ ConsumerApi/Dockerfile | 5 ++++- ConsumerApi/Dockerfile.debug | 3 +++ Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile | 2 +- docker-compose/docker-compose.yml | 7 +------ helm/charts/adminui/templates/deployment.yaml | 2 -- 9 files changed, 18 insertions(+), 16 deletions(-) rename AdminUi/src/AdminUi/ClientApp/{Dockerfile => Dockerfile.debug} (91%) diff --git a/.ci/docker-compose.test.yml b/.ci/docker-compose.test.yml index f752ebac1e..a6a6d02781 100644 --- a/.ci/docker-compose.test.yml +++ b/.ci/docker-compose.test.yml @@ -8,7 +8,6 @@ services: dockerfile: ConsumerApi/Dockerfile environment: - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 ports: - "5000:80" depends_on: @@ -37,7 +36,6 @@ services: dockerfile: AdminUi/src/AdminUi/Dockerfile environment: - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 ports: - "5173:80" depends_on: diff --git a/AdminUi/src/AdminUi/ClientApp/Dockerfile b/AdminUi/src/AdminUi/ClientApp/Dockerfile.debug similarity index 91% rename from AdminUi/src/AdminUi/ClientApp/Dockerfile rename to AdminUi/src/AdminUi/ClientApp/Dockerfile.debug index cc6fef565f..a4a60a3ed8 100644 --- a/AdminUi/src/AdminUi/ClientApp/Dockerfile +++ b/AdminUi/src/AdminUi/ClientApp/Dockerfile.debug @@ -2,12 +2,12 @@ FROM node:20 WORKDIR /app +EXPOSE 4200 + COPY AdminUi/src/AdminUi/ClientApp/package*.json ./ COPY AdminUi/src/AdminUi/ClientApp/tsconfig.json ./ COPY AdminUi/src/AdminUi/ClientApp/tsconfig.app.json ./ RUN npm install -EXPOSE 4200 - -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] diff --git a/AdminUi/src/AdminUi/Dockerfile b/AdminUi/src/AdminUi/Dockerfile index 44ba5bf4dc..ffc8b61736 100644 --- a/AdminUi/src/AdminUi/Dockerfile +++ b/AdminUi/src/AdminUi/Dockerfile @@ -49,6 +49,9 @@ RUN npm i -g @angular/cli RUN dotnet publish /property:WarningLevel=0 /p:UseAppHost=false --no-restore --configuration Release --output /app/publish "AdminUi.csproj" FROM base AS final + +ENV ASPNETCORE_URLS=http://0.0.0.0:80 + WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Backbone.AdminUi.dll"] \ No newline at end of file +ENTRYPOINT ["dotnet", "Backbone.AdminUi.dll"] diff --git a/AdminUi/src/AdminUi/Dockerfile.debug b/AdminUi/src/AdminUi/Dockerfile.debug index eca0cd5803..91a93acc9d 100644 --- a/AdminUi/src/AdminUi/Dockerfile.debug +++ b/AdminUi/src/AdminUi/Dockerfile.debug @@ -3,4 +3,6 @@ EXPOSE 80 WORKDIR /app +ENV ASPNETCORE_URLS=http://0.0.0.0:80 + ENTRYPOINT ["dotnet", "watch", "--non-interactive", "--project", "AdminUi/src/AdminUi/AdminUi.csproj"] diff --git a/ConsumerApi/Dockerfile b/ConsumerApi/Dockerfile index f6b61a9160..53bfd4bf81 100644 --- a/ConsumerApi/Dockerfile +++ b/ConsumerApi/Dockerfile @@ -7,10 +7,13 @@ RUN dotnet restore "ConsumerApi/ConsumerApi.csproj" RUN dotnet publish /property:WarningLevel=0 --configuration Release --output /app --no-restore "ConsumerApi/ConsumerApi.csproj" -# Run +# Run FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.18 EXPOSE 80 WORKDIR /app + +ENV ASPNETCORE_URLS=http://0.0.0.0:80 + ENV Logging__Console__FormatterName= ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 RUN apk add icu-libs diff --git a/ConsumerApi/Dockerfile.debug b/ConsumerApi/Dockerfile.debug index 8730ee39f9..f4cf38dd04 100644 --- a/ConsumerApi/Dockerfile.debug +++ b/ConsumerApi/Dockerfile.debug @@ -1,6 +1,9 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 + EXPOSE 80 WORKDIR /app +ENV ASPNETCORE_URLS=http://0.0.0.0:80 + ENTRYPOINT ["dotnet", "watch", "--non-interactive", "--project", "ConsumerApi/ConsumerApi.csproj"] diff --git a/Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile b/Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile index 983a1a33ab..a90edb332d 100644 --- a/Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile +++ b/Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile @@ -15,6 +15,6 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 RUN apk add icu-libs COPY --from=build-env /app . -LABEL org.opencontainers.image.source = "https://github.com/nmshd/bkb-challenges" +LABEL org.opencontainers.image.source = "https://github.com/nmshd/backbone" ENTRYPOINT ["dotnet", "Backbone.Modules.Challenges.Jobs.Cleanup.dll"] diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 8b63bb5d72..f8f21e109d 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -8,7 +8,6 @@ services: dockerfile: ConsumerApi/Dockerfile.debug environment: - ASPNETCORE_ENVIRONMENT=Local - - ASPNETCORE_URLS=http://0.0.0.0:80 - Modules__Files__Infrastructure__BlobStorage__ConnectionInfo=${ENMESHED_BLOB_STORAGE_CONNECTION_STRING} # set this environment variable on your local system to an appropriate value (DefaultEndpointsProtocol=https;AccountName=;AccountKey=;EndpointSuffix=core.windows.net) - Modules__Synchronization__Infrastructure__BlobStorage__ConnectionInfo=${ENMESHED_BLOB_STORAGE_CONNECTION_STRING} # set this environment variable on your local system to an appropriate value (DefaultEndpointsProtocol=https;AccountName=;AccountKey=;EndpointSuffix=core.windows.net) @@ -102,7 +101,6 @@ services: dockerfile: AdminUi/src/AdminUi/Dockerfile.debug environment: - ASPNETCORE_ENVIRONMENT=Local - - ASPNETCORE_URLS=http://0.0.0.0:80 ports: - "5173:80" depends_on: @@ -121,10 +119,7 @@ services: hostname: adminUi build: context: .. - dockerfile: AdminUi/src/AdminUi/ClientApp/Dockerfile - environment: - - ASPNETCORE_ENVIRONMENT=Local - - ASPNETCORE_URLS=http://0.0.0.0:80 + dockerfile: AdminUi/src/AdminUi/ClientApp/Dockerfile.debug ports: - "4200:4200" depends_on: diff --git a/helm/charts/adminui/templates/deployment.yaml b/helm/charts/adminui/templates/deployment.yaml index ab09763caa..bfc8bbb658 100644 --- a/helm/charts/adminui/templates/deployment.yaml +++ b/helm/charts/adminui/templates/deployment.yaml @@ -81,8 +81,6 @@ spec: subPath: appsettings.override.json readOnly: true env: - - name: ASPNETCORE_URLS - value: http://0.0.0.0:80 {{- if .Values.global.useBuiltInEventbus }} - name: infrastructure__eventBus__vendor value: RabbitMQ