From 306c253fa6d01229859c9cc995cd6c88b5eabb58 Mon Sep 17 00:00:00 2001 From: Vivek Agrawal Date: Sun, 7 Jul 2024 12:54:09 +0530 Subject: [PATCH] Docker changes --- deployment/mongo-db-deployment.yaml | 40 ++++++++++++++++++ .../my-springboot-mongo-app-deployment.yaml | 41 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 deployment/mongo-db-deployment.yaml create mode 100644 deployment/my-springboot-mongo-app-deployment.yaml diff --git a/deployment/mongo-db-deployment.yaml b/deployment/mongo-db-deployment.yaml new file mode 100644 index 0000000..592a68f --- /dev/null +++ b/deployment/mongo-db-deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongodb +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + template: + metadata: + labels: + app: mongodb + spec: + containers: + - name: mongodb + image: mongo:latest + ports: + - containerPort: 27017 + env: + - name: MONGO_INITDB_DATABASE + value: mongoboot + volumeMounts: + - mountPath: /data/db + name: mongo-data + volumes: + - name: mongo-data + hostPath: + path: /Users/Shared/mongo-db/data +--- +apiVersion: v1 +kind: Service +metadata: + name: mongodb +spec: + ports: + - port: 27017 + targetPort: 27017 + selector: + app: mongodb \ No newline at end of file diff --git a/deployment/my-springboot-mongo-app-deployment.yaml b/deployment/my-springboot-mongo-app-deployment.yaml new file mode 100644 index 0000000..6b5d5e6 --- /dev/null +++ b/deployment/my-springboot-mongo-app-deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-springboot-mongo-app +spec: + replicas: 1 + selector: + matchLabels: + app: my-springboot-mongo-app + template: + metadata: + labels: + app: my-springboot-mongo-app + spec: + containers: + - name: my-springboot-mongo-app + image: vivek081141/my-springboot-mongo-app:latest + ports: + - containerPort: 18012 + env: + - name: SPRING_DATA_MONGODB_HOST + value: mongodb + - name: SPRING_DATA_MONGODB_PORT + value: "27017" + - name: SPRING_DATA_MONGODB_DATABASE + value: mongoboot + - name: SPRING_PROFILES_ACTIVE + value: prod + nodeSelector: + kubernetes.io/arch: arm64 +--- +apiVersion: v1 +kind: Service +metadata: + name: my-springboot-mongo-app +spec: + ports: + - port: 18012 + targetPort: 18012 + selector: + app: my-springboot-mongo-app \ No newline at end of file