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,5 +1,15 @@
# webpack-template
# Weather Project
Vanilla template for webpack
This project is a web application that allows you to search for weather information for different locations. It is built using HTML, CSS, and JavaScript.
## Features
* Search for weather by city name.
* Displays current weather conditions.
## Local Development
To run this project locally, follow these steps:
1. **Clone the repository:**
sets up common utilities needed for vanilla JS/HTML/CSS development

35
weather/devops/Dockerfile Normal file
View file

@ -0,0 +1,35 @@
# Use a Node.js base image to build the project
FROM node:18-alpine as builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json (or yarn.lock)
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the project using webpack
RUN npm run build
# Use an official nginx image as the base image
FROM nginx:stable-alpine
# Set the working directory
WORKDIR /var/www/html
# Remove default nginx content
RUN rm -rf ./*
# Copy the built files from the builder stage to nginx's html directory
COPY --from=builder /app/dist .
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]

View file

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