adding devops

used gemini to create the k8s/dockerfiles faster
This commit is contained in:
Smigz 2025-05-02 16:47:07 +00:00
parent 5c09c5a22f
commit 6c14a968c3
74 changed files with 2061 additions and 16 deletions

View file

@ -1,8 +1,17 @@
# React + Vite
# Shopping Cart Project
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
## Description
This project is a web application for an online shopping cart, built using React. It allows users to browse products, add them to a cart, and manage their cart contents.
Before you begin, ensure you have the following installed:
* **Node.js**: Make sure you have Node.js installed. You can download it from [https://nodejs.org/](https://nodejs.org/).
* **npm**: npm comes bundled with Node.js, so you should have it automatically.
## Getting Started
1. **Clone the repository**:
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

View file

@ -0,0 +1,19 @@
# Stage 1: Build the React application
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View file

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: shopping-cart-deployment
spec:
replicas: 3
selector:
matchLabels:
app: shopping-cart
template:
metadata:
labels:
app: shopping-cart
spec:
containers:
- name: shopping-cart
image: ghcr.io/smiggiddy/odin-codeprojects/shopping-cart:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: shopping-cart-service
spec:
selector:
app: shopping-cart
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer