Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/bin/
**/obj/
**/.vs/
**/.idea/
**/.git/
8 changes: 8 additions & 0 deletions compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ services:
- "4317:18889"
networks:
- dev_network

resource-server:
image: aspire-resource-server:latest
ports:
- "8043:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock # This is important so that the resource server can query docker engine

Comment on lines +36 to +43
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I created this docker-compose file, the main reason was to create a sample environment from which the resource server could inspect and collect information. I don't see how adding the resource server to the compose file would help. Would you care to shine some light on why this is helpful?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to show how the resource server can be configured with docker compose as an example. User can then point their service to the docker container instance of resource server or the executable.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I'd appreciate it if you could move this sample compose file into a separate samples directory, preferably with a README.md file describing what the sample directory contains and why it's there.

networks:
dev_network:
driver: bridge
Expand Down
28 changes: 28 additions & 0 deletions docker-support/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 80

ENV DOTNET_CLI_TELEMETRY_OPTOUT=true \
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true \
ASPNETCORE_URLS=http://+:80 \
ASPNETCORE_ENVIRONMENT=Production

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release

WORKDIR "/src"
COPY . .

RUN dotnet restore "/src/src/Aspire.ResourceService.Standalone.Server/Aspire.ResourceService.Standalone.Server.csproj"

RUN dotnet build "/src/src/Aspire.ResourceService.Standalone.Server/Aspire.ResourceService.Standalone.Server.csproj" -f net9.0 -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release

RUN dotnet publish "/src/src/Aspire.ResourceService.Standalone.Server/Aspire.ResourceService.Standalone.Server.csproj" -f net9.0 -c $BUILD_CONFIGURATION -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Aspire.ResourceService.Standalone.Server.dll"]
21 changes: 21 additions & 0 deletions docker-support/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Exit immediately if a command exits with a non-zero status.
set -e
# Ensure that the exit status of a pipeline is the status of the last command to exit with a non-zero status.
set -o pipefail

current_date=$(date +%Y%m%d)

docker pull mcr.microsoft.com/dotnet/sdk:9.0
docker pull mcr.microsoft.com/dotnet/aspnet:9.0

docker buildx build --platform linux/arm64,linux/amd64 -f Dockerfile \
-t aspire-resource-server:latest \
-t aspire-resource-server:$current_date \
-t timdinh/aspire-resource-server:latest \
-t timdinh/aspire-resource-server:$current_date \
..

docker push timdinh/aspire-resource-server:latest
docker push timdinh/aspire-resource-server:$current_date