diff --git a/Dockerfile b/Dockerfile index 5818f0b..dac3853 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,7 @@ -# Step 1: Build the React app -FROM node:20 AS build +# - Comment, ignored by docker +# - Docker Directives/intsructions will be in UPPER CASE +# FROM -> used for specifying base image +FROM nginx -# Set working directory -WORKDIR /app - -# Copy package.json and package-lock.json -COPY package.json package-lock.json ./ - -# Install dependencies -RUN npm install - -# Copy the rest of the application files -COPY . . - -# Build the app for production -RUN npm run build - -# Step 2: Set up the production server with Nginx -FROM nginx:alpine - -# Copy the build output to Nginx's public directory -COPY --from=build /app/build /usr/share/nginx/html - -# Expose port 80 -EXPOSE 80 - -# Start Nginx -CMD ["nginx", "-g", "daemon off;"] +#COPY -> USED FOR COPYING FILES FROM HOST to YOUR CUSTOM IMAGE +COPY . /usr/share/nginx/html \ No newline at end of file diff --git a/k8s/pod.yaml b/k8s/pod.yaml new file mode 100644 index 0000000..239bf75 --- /dev/null +++ b/k8s/pod.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + name: pod-nginx +spec: + containers: + - name: c1 + image: nginx + ports: + - containerPort: 80 \ No newline at end of file diff --git a/k8s/react-deployment.yaml b/k8s/react-deployment.yaml new file mode 100644 index 0000000..81b4a6a --- /dev/null +++ b/k8s/react-deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: react-deployment + labels: + app: react +spec: + replicas: 2 + selector: + matchLabels: + app: react + template: + metadata: + labels: + app: react + spec: + containers: + - name: c2 + image: jithesh0017/react-app + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: react-service +spec: + type: LoadBalancer + selector: + app: react + ports: + - protocol: TCP + port: 80 diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..ad11f67 --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: react-service +spec: + type: NodePort + selector: + app: react + ports: + - protocol: TCP + port: 80 + nodePort: 30015 diff --git a/package.json b/package.json index 5ffa878..8c5bf6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lms-react", - "version": "1.1", + "version": "4.2", "private": true, "dependencies": { "@testing-library/dom": "^10.4.0", diff --git a/react-app service.yaml b/react-app service.yaml new file mode 100644 index 0000000..8e8f3c6 --- /dev/null +++ b/react-app service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: React-app-Service +spec: + type: Nodeport + selector: + app: React-app + ports: + - protocol: TCP + port: 80 + nodeport: 30008 \ No newline at end of file diff --git a/src/components/FrontPage.js b/src/components/FrontPage.js index 4a9c1f7..3a730ab 100644 --- a/src/components/FrontPage.js +++ b/src/components/FrontPage.js @@ -20,7 +20,7 @@ const FrontPage = () => { return (