diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..87fb574d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Use a base Java image +FROM openjdk:17-jdk-slim + +# Set the working directory +WORKDIR /app + +# Copy the JAR file built by Maven +COPY target/*.jar app.jar + +# Expose the application port +EXPOSE 8080 + +# Command to run the application +ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 000000000..078eae343 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: spring-petclinic-deployment +spec: + replicas: 2 + selector: + matchLabels: + app: spring-petclinic + template: + metadata: + labels: + app: spring-petclinic + spec: + containers: + - name: spring-petclinic + image: prithvirajpro/spring-petclinic + ports: + - containerPort: 8080 diff --git a/service.yaml b/service.yaml new file mode 100644 index 000000000..33d936ab2 --- /dev/null +++ b/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: spring-petclinic-service +spec: + selector: + app: spring-petclinic + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + type: NodePort