fix(k8s): migrate backend from Bun to Node.js and fix registry URLs

Backend Dockerfile changes:
- Replace Bun base image with node:20-alpine for production stability
- Change bun install to npm ci for dependency installation
- Update health check from Bun fetch to curl command
- Change CMD from 'bun server.js' to 'node server.js'

Deployment manifest changes:
- Update backend image URL to gitea-gitea-http.taildb3494.ts.net
- Update frontend image URL to gitea-gitea-http.taildb3494.ts.net
- Fix registry server reference in image-pull-secret.yaml comment

Rationale:
- Backend server.js is written for Node.js/Express, not Bun.serve()
- Bun was causing CrashLoopBackOff due to incompatible server API
- Node.js provides better stability for production Express apps
- Fixed registry URLs to match actual Gitea service name in cluster

🤖 Generated with OpenCode

Co-Authored-By: OpenCode <noreply@opencode.com>
This commit is contained in:
William Valentin
2025-11-05 12:59:06 -08:00
parent cae0861f28
commit 758de862aa
4 changed files with 8 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# Multi-stage build for multi-architecture support (AMD64, ARM64)
FROM --platform=$BUILDPLATFORM oven/bun:1-alpine AS builder
FROM --platform=$BUILDPLATFORM node:20-alpine AS builder
WORKDIR /app
@@ -7,13 +7,13 @@ WORKDIR /app
COPY package*.json ./
# Install dependencies
RUN bun install --production
RUN npm ci --production
# Copy source code
COPY . .
# --- Production stage ---
FROM --platform=$TARGETPLATFORM oven/bun:1-alpine
FROM --platform=$TARGETPLATFORM node:20-alpine
# Install curl for health checks and other utilities
RUN apk add --no-cache curl wget
@@ -32,7 +32,7 @@ EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \
CMD bun -e "fetch('http://localhost:5000/api/health').then(r=>process.exit(r.ok?0:1))"
CMD curl -f http://localhost:5000/api/health || exit 1
# Start server
CMD ["bun", "server.js"]
CMD ["node", "server.js"]

View File

@@ -44,7 +44,7 @@ spec:
containers:
- name: backend
# Update with your registry and tag
image: gitea-http.taildb3494.ts.net/will/adopt-a-street/backend:latest
image: gitea-gitea-http.taildb3494.ts.net/will/adopt-a-street/backend:latest
imagePullPolicy: Always
ports:
- containerPort: 5000

View File

@@ -34,7 +34,7 @@ spec:
containers:
- name: frontend
# Update with your registry and tag
image: gitea-http.taildb3494.ts.net/will/adopt-a-street/frontend:latest
image: gitea-gitea-http.taildb3494.ts.net/will/adopt-a-street/frontend:latest
imagePullPolicy: Always
ports:
- containerPort: 80

View File

@@ -13,7 +13,7 @@ data:
# 3. Apply with: kubectl apply -f image-pull-secret.yaml
# 4. To generate the proper config, run:
# kubectl create secret docker-registry regcred \
# --docker-server=gitea-http.taildb3494.ts.net \
# --docker-server=gitea-gitea-http.taildb3494.ts.net \
# --docker-username=will \
# --docker-password=YOUR_GITEA_PASSWORD \
# --namespace=adopt-a-street \