Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Containerize C# Pubsub Quickstart #1045

Draft
wants to merge 2 commits into
base: release-1.14
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 26 additions & 0 deletions pub_sub/csharp/deploy/checkout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: checkout-app
labels:
app: checkout
spec:
replicas: 1
selector:
matchLabels:
app: checkout
template:
metadata:
labels:
app: checkout
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "checkout"
dapr.io/log-as-json: "true"
dapr.io/log-level: "debug"
dapr.io/enable-api-logging: "true"
spec:
containers:
- name: checkout-csharp
image: docker.io/library/checkout:latest
imagePullPolicy: Never
47 changes: 47 additions & 0 deletions pub_sub/csharp/deploy/order-processor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
kind: Service
apiVersion: v1
metadata:
name: order-processor-app
labels:
app: order-processor
spec:
selector:
app: order-processor
ports:
- protocol: TCP
port: 7006
targetPort: 7006
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-processor-app
labels:
app: order-processor
spec:
replicas: 1
selector:
matchLabels:
app: order-processor
template:
metadata:
labels:
app: order-processor
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "order-processor"
dapr.io/app-port: "7006"
dapr.io/log-as-json: "true"
dapr.io/log-level: "debug"
dapr.io/enable-api-logging: "true"
spec:
containers:
- name: order-processor-csharp
image: docker.io/library/order-processor:latest
ports:
- containerPort: 7006
imagePullPolicy: Never
env:
- name: "ASPNETCORE_HTTP_PORTS"
value: "7006"
16 changes: 16 additions & 0 deletions pub_sub/csharp/deploy/pubsub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: orderpubsub
spec:
type: pubsub.redis
version: v1
metadata:
- name: redisHost
value: dapr-dev-redis-master.default.svc.cluster.local:6379
- name: redisPassword
secretKeyRef:
name: dapr-dev-redis
key: redis-password
auth:
secretStore: kubernetes
15 changes: 15 additions & 0 deletions pub_sub/csharp/sdk/checkout/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

# Copy everything
COPY ["/.", "./"]
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "checkout.dll"]
16 changes: 16 additions & 0 deletions pub_sub/csharp/sdk/order-processor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

# Copy everything
COPY ["/.", "./"]
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "order-processor.dll"]
EXPOSE 7006
Loading