diff --git a/src/Release-DockerImage.bat b/src/Release-DockerImage.bat new file mode 100644 index 0000000..93070d3 --- /dev/null +++ b/src/Release-DockerImage.bat @@ -0,0 +1,7 @@ +@echo off + +REM Change directory to the location of the script +cd /d %~dp0 + +REM Invoke the PowerShell script (Release-NuGetPackage.ps1) in the same directory +powershell -ExecutionPolicy Bypass -File "%~dp0Release-DockerImage.ps1" diff --git a/src/Release-DockerImage.ps1 b/src/Release-DockerImage.ps1 new file mode 100644 index 0000000..94c984b --- /dev/null +++ b/src/Release-DockerImage.ps1 @@ -0,0 +1,36 @@ +# Set variables +$projectName = "dapr-test" +$harborUrl = "cr.maks-it.com" # e.g., "harbor.yourdomain.com" +$tag = "latest" # Customize the tag as needed + +# Retrieve username and password from environment variable +$creds = $Env:CR_MAKS_IT -split '\|' +$harborUsername = $creds[0] +$harborPassword = $creds[1] + +# Authenticate with Harbor +docker login $harborUrl -u $harborUsername -p $harborPassword + +# List of services to build and push with the current context +$services = @{ + "publisher" = "Publisher/Dockerfile" + "subscriber" = "Subscriber/Dockerfile" +} + +$contextPath = "." + +foreach ($service in $services.Keys) { + $dockerfilePath = $services[$service] + $imageName = "$harborUrl/$projectName/${service}:${tag}" + + # Build the Docker image + Write-Output "Building image $imageName from $dockerfilePath..." + docker build -t $imageName -f $dockerfilePath $contextPath + + # Push the Docker image + Write-Output "Pushing image $imageName..." + docker push $imageName +} + +# Logout after pushing images +docker logout $harborUrl \ No newline at end of file diff --git a/src/deployment.yaml b/src/deployment.yaml index 94b0d13..e93bbf6 100644 --- a/src/deployment.yaml +++ b/src/deployment.yaml @@ -15,13 +15,28 @@ spec: annotations: dapr.io/enabled: "true" dapr.io/app-id: "publisher" - dapr.io/app-port: "3000" + dapr.io/app-port: "5000" # Adjust to your service port spec: containers: - - name: publisher - image: daprio/quickstart-pubsub-publisher - ports: - - containerPort: 3000 + - name: publisher + image: cr.maks-it.com/dapr-test/subscriber:latest + ports: + - containerPort: 5000 # Match your internal app port + +--- + +apiVersion: v1 +kind: Service +metadata: + name: publisher-service + namespace: dapr-test +spec: + selector: + app: publisher + ports: + - protocol: TCP + port: 80 + targetPort: 5000 # Match the internal port of the publisher service --- @@ -42,15 +57,10 @@ spec: annotations: dapr.io/enabled: "true" dapr.io/app-id: "subscriber" - dapr.io/app-port: "3001" + dapr.io/app-port: "5000" # Adjust to match the subscriber service port spec: containers: - - name: subscriber - image: daprio/quickstart-pubsub-subscriber - ports: - - containerPort: 3001 - env: - - name: PUBSUB_TOPIC - value: "pubsub" # The topic used by pubsub component - - name: STATE_STORE - value: "statestore" # The name of your statestore component + - name: subscriber + image: cr.maks-it.com/dapr-test/subscriber:latest + ports: + - containerPort: 5000 # Match the internal port of the subscriber service diff --git a/src/docker-compose/dapr/components/statestore.yaml b/src/docker-compose/dapr/components/statestore.yaml index b88f71d..2ca1cce 100644 --- a/src/docker-compose/dapr/components/statestore.yaml +++ b/src/docker-compose/dapr/components/statestore.yaml @@ -10,7 +10,7 @@ spec: - name: redisHost value: redis:6379 - name: keyPrefix - value: none # Disables prefixing + value: none ---