|
| 1 | +# Build context should be from the repository root |
| 2 | +# Example build commands: |
| 3 | +# docker build -f samples/pubsub/native/Core_10/Dockerfile -t pubsub-native-core10 . |
| 4 | +# podman build -f samples/pubsub/native/Core_10/Dockerfile -t pubsub-native-core10 . |
| 5 | + |
| 6 | +FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build |
| 7 | +WORKDIR /src |
| 8 | + |
| 9 | +# Set environment variable for .NET 10 preview builds |
| 10 | +ENV DOTNET_SYSTEM_NET_SECURITY_NOREVOCATIONCHECKBYDEFAULT=true |
| 11 | + |
| 12 | +# Copy necessary build files from repository root |
| 13 | +COPY nuget.config . |
| 14 | +COPY Directory.Build.props . |
| 15 | +COPY BannedSymbols.txt . |
| 16 | + |
| 17 | +# Copy the sample solution |
| 18 | +COPY samples/pubsub/native/Core_10/ ./samples/pubsub/native/Core_10/ |
| 19 | + |
| 20 | +# Build the solution |
| 21 | +WORKDIR /src/samples/pubsub/native/Core_10 |
| 22 | +RUN dotnet restore |
| 23 | +RUN dotnet publish Publisher/Publisher.csproj -f net10.0 -o /app/publisher --no-restore |
| 24 | +RUN dotnet publish Subscriber/Subscriber.csproj -f net10.0 -o /app/subscriber --no-restore |
| 25 | + |
| 26 | +FROM mcr.microsoft.com/dotnet/runtime:10.0-preview AS runtime |
| 27 | +WORKDIR /app |
| 28 | + |
| 29 | +# Set environment variable for .NET 10 preview runtime |
| 30 | +ENV DOTNET_SYSTEM_NET_SECURITY_NOREVOCATIONCHECKBYDEFAULT=true |
| 31 | + |
| 32 | +# Install expect and process management tools |
| 33 | +RUN apt-get update && apt-get install -y expect procps && rm -rf /var/lib/apt/lists/* |
| 34 | + |
| 35 | +# Create .learningtransport directory for LearningTransport storage |
| 36 | +RUN mkdir -p .learningtransport |
| 37 | + |
| 38 | +# Copy published applications |
| 39 | +COPY --from=build /app/publisher ./publisher/ |
| 40 | +COPY --from=build /app/subscriber ./subscriber/ |
| 41 | + |
| 42 | +# Copy startup script |
| 43 | +COPY samples/pubsub/native/Core_10/run_sample.sh ./ |
| 44 | +RUN chmod +x run_sample.sh |
| 45 | + |
| 46 | +CMD ["./run_sample.sh"] |
0 commit comments