CHORE: Added k3s deployment architecture (Dockerfile and k8s.yaml)
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
|||||||
|
# Step 1: Build the static Next.js application
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Step 2: Serve the static files with NGINX
|
||||||
|
FROM nginx:alpine
|
||||||
|
# Copy the static export from Next.js (the 'out' folder) to the NGINX html directory
|
||||||
|
COPY --from=builder /app/out /usr/share/nginx/html
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: mrhavens-one
|
||||||
|
namespace: default
|
||||||
|
labels:
|
||||||
|
app: mrhavens-one
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mrhavens-one
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mrhavens-one
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: web
|
||||||
|
image: mrhavens/mrhavens-one:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "256Mi"
|
||||||
|
cpu: "200m"
|
||||||
|
requests:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "100m"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mrhavens-one-service
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: mrhavens-one
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: mrhavens-one-ingress
|
||||||
|
namespace: default
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: "nginx"
|
||||||
|
# Assumes cert-manager is configured for Cloudflare SSL
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
spec:
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- mrhavens.one
|
||||||
|
- www.mrhavens.one
|
||||||
|
secretName: mrhavens-one-tls
|
||||||
|
rules:
|
||||||
|
- host: mrhavens.one
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: mrhavens-one-service
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- host: www.mrhavens.one
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: mrhavens-one-service
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
Reference in New Issue
Block a user