Skip to content

Commit

Permalink
Admin UI and Consumer API: containers run on wrong ports (#427)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tnotheis authored Dec 5, 2023
1 parent 84621b6 commit 88f2015
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .ci/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
CMD ["npm", "start"]
5 changes: 4 additions & 1 deletion AdminUi/src/AdminUi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
ENTRYPOINT ["dotnet", "Backbone.AdminUi.dll"]
2 changes: 2 additions & 0 deletions AdminUi/src/AdminUi/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
5 changes: 4 additions & 1 deletion ConsumerApi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ConsumerApi/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion Modules/Challenges/src/Challenges.Jobs.Cleanup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
7 changes: 1 addition & 6 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=<account-name>;AccountKey=<account-key>;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=<account-name>;AccountKey=<account-key>;EndpointSuffix=core.windows.net)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions helm/charts/adminui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 88f2015

Please sign in to comment.