From 1459c6625ebcebfcf06478ec113eeb32219b4a8e Mon Sep 17 00:00:00 2001 From: Himanshu Kumar <97390553+agarwalhimanshugaya@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:49:09 +0000 Subject: [PATCH] add dockerfile and kubernetes file --- Dockerfile | 11 +++++++++++ deployment.yaml | 19 +++++++++++++++++++ service.yaml | 12 ++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 Dockerfile create mode 100644 deployment.yaml create mode 100644 service.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d9f23af --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# Use the official nginx image as the base image +FROM nginx:alpine + +# Copy the HTML, CSS, and JavaScript files into the container +COPY ./ /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start nginx when the container launches +CMD ["nginx", "-g", "daemon off;"] diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..21e723a --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: static-web-app +spec: + replicas: 2 + selector: + matchLabels: + app: static-web-app + template: + metadata: + labels: + app: static-web-app + spec: + containers: + - name: static-web-app + image: your-image-name + ports: + - containerPort: 80 diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..6cf4235 --- /dev/null +++ b/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: static-web-app-service +spec: + selector: + app: static-web-app + ports: + - protocol: TCP + port: 3000 + targetPort: 80 + type: LoadBalancer