Add pure Node.js deployment without Docker

This commit is contained in:
Unchained
2026-03-06 19:10:56 +02:00
parent cac26e73ce
commit ced136fb4d

View File

@@ -1,25 +1,19 @@
apiVersion: v1
kind: Secret
metadata:
name: git-credentials
namespace: manoonoils
type: Opaque
name: woocommerce-credentials
namespace: manoonoilstype: Opaque
stringData:
# Gitea SSH private key (for cloning)
# Generate with: ssh-keygen -t ed25519 -f gitea-deploy-key
# Add public key to Gitea repo deploy keys
SSH_KEY: |
-----BEGIN OPENSSH PRIVATE KEY-----
# REPLACE WITH ACTUAL PRIVATE KEY
-----END OPENSSH PRIVATE KEY-----
GIT_HOST: "100.74.155.73"
WOOCOMMERCE_URL: "https://manoonoils.com"
# You'll need to update these with actual credentials
WOOCOMMERCE_CONSUMER_KEY: "PLACEHOLDER_KEY"
WOOCOMMERCE_CONSUMER_SECRET: "PLACEHOLDER_SECRET"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: storefront
namespace: manoonoils
spec:
namespace: manoonoilsspec:
replicas: 1
selector:
matchLabels:
@@ -30,37 +24,55 @@ spec:
app: storefront
spec:
initContainers:
- name: build
image: node:20-alpine
- name: clone
image: alpine/git:latest
command:
- sh
- -c
- |
set -e
apk add --no-cache git
# Install git and ssh
apk add --no-cache git openssh-client
# Clone from Gitea (using HTTP with ssl verify disabled for self-signed cert)
git config --global http.sslVerify false
git clone --depth 1 --branch master \
https://100.74.155.73:3000/unchained/manoon-headless.git \
/workspace
# Setup SSH for Gitea
mkdir -p /root/.ssh
cp /secrets/SSH_KEY /root/.ssh/id_ed25519
chmod 600 /root/.ssh/id_ed25519
ssh-keyscan -p 222 -H $(cat /secrets/GIT_HOST) > /root/.ssh/known_hosts 2>/dev/null || \
ssh-keyscan -p 222 -H 100.74.155.73 > /root/.ssh/known_hosts 2>/dev/null || true
# Clone repository
echo "Cloning from Gitea..."
git clone --depth 1 --branch master ssh://git@100.74.155.73:222/unchained/manoon-headless.git /workspace
cd /workspace
echo "Clone complete. Files:"
ls -la /workspace
volumeMounts:
- name: workspace
mountPath: /workspace
securityContext:
runAsUser: 0
- name: install
image: node:20-alpine
workingDir: /workspace
command:
- sh
- -c
- |
set -e
echo "Installing dependencies..."
npm ci --prefer-offline --no-audit --silent
echo "Building Next.js..."
echo "Dependencies installed."
volumeMounts:
- name: workspace
mountPath: /workspace
securityContext:
runAsUser: 0
- name: build
image: node:20-alpine
workingDir: /workspace
command:
- sh
- -c
- |
set -e
echo "Building Next.js app..."
npm run build
echo "Build complete!"
ls -la /workspace/.next/
env:
- name: NODE_ENV
value: "production"
@@ -84,9 +96,6 @@ spec:
volumeMounts:
- name: workspace
mountPath: /workspace
- name: git-secret
mountPath: /secrets
readOnly: true
securityContext:
runAsUser: 0
resources:
@@ -99,13 +108,10 @@ spec:
containers:
- name: storefront
image: node:20-alpine
workingDir: /workspace
command:
- sh
- -c
- |
cd /workspace
echo "Starting Next.js production server..."
exec npm start
- npm
- start
ports:
- containerPort: 3000
env:
@@ -147,7 +153,7 @@ spec:
path: /
port: 3000
periodSeconds: 10
failureThreshold: 60
failureThreshold: 30
livenessProbe:
httpGet:
path: /
@@ -164,7 +170,3 @@ spec:
- name: workspace
emptyDir:
sizeLimit: 2Gi
- name: git-secret
secret:
secretName: git-credentials
defaultMode: 0400