refactor(k8s): use pre-built GHCR image instead of building in pod
Some checks failed
Build and Deploy / build (push) Has been cancelled
Some checks failed
Build and Deploy / build (push) Has been cancelled
- Remove init containers (clone, install, build) - Use ghcr.io/unchainedio/manoon-headless:latest image - Faster pod startup, less resource usage - Image built by GitHub Actions on push to master
This commit is contained in:
@@ -13,112 +13,9 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: storefront
|
app: storefront
|
||||||
spec:
|
spec:
|
||||||
initContainers:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
command:
|
|
||||||
- sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -e
|
|
||||||
apk add --no-cache git
|
|
||||||
# Clean workspace if it exists (handles pod restarts)
|
|
||||||
if [ -d /workspace/.git ]; then
|
|
||||||
echo "Workspace exists, pulling latest changes..."
|
|
||||||
cd /workspace
|
|
||||||
git fetch origin master
|
|
||||||
git reset --hard origin/master
|
|
||||||
else
|
|
||||||
echo "Cloning fresh repository..."
|
|
||||||
rm -rf /workspace/*
|
|
||||||
git clone --depth 1 --branch master \
|
|
||||||
http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git \
|
|
||||||
/workspace
|
|
||||||
fi
|
|
||||||
echo "Clone/update complete."
|
|
||||||
volumeMounts:
|
|
||||||
- name: workspace
|
|
||||||
mountPath: /workspace
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 256Mi
|
|
||||||
- name: install
|
|
||||||
image: node:20-slim
|
|
||||||
workingDir: /workspace
|
|
||||||
command:
|
|
||||||
- sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -e
|
|
||||||
echo "Installing dependencies..."
|
|
||||||
npm install --prefer-offline --no-audit 2>&1
|
|
||||||
echo "Dependencies installed."
|
|
||||||
volumeMounts:
|
|
||||||
- name: workspace
|
|
||||||
mountPath: /workspace
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 2000m
|
|
||||||
memory: 3Gi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 1Gi
|
|
||||||
- name: build
|
|
||||||
image: node:20-slim
|
|
||||||
workingDir: /workspace
|
|
||||||
command:
|
|
||||||
- sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -e
|
|
||||||
echo "Building Next.js app..."
|
|
||||||
npm run build
|
|
||||||
echo "Build complete!"
|
|
||||||
env:
|
|
||||||
- name: NODE_ENV
|
|
||||||
value: "production"
|
|
||||||
- name: NEXT_PUBLIC_SALEOR_API_URL
|
|
||||||
value: "https://api.manoonoils.com/graphql/"
|
|
||||||
- name: NEXT_PUBLIC_SITE_URL
|
|
||||||
value: "https://manoonoils.com"
|
|
||||||
- name: DASHBOARD_URL
|
|
||||||
value: "https://dashboard.manoonoils.com"
|
|
||||||
- name: NEXT_PUBLIC_OPENPANEL_CLIENT_ID
|
|
||||||
value: "fa61f8ae-0b5d-4187-a9b1-5a04b0025674"
|
|
||||||
- name: OPENPANEL_CLIENT_SECRET
|
|
||||||
value: "91126be0d1e78e657e0427df82733832.c6d30edf6ee673da9650a883604169a13ab8579a0dde70cb39b477f4cf441f90"
|
|
||||||
- name: OPENPANEL_API_URL
|
|
||||||
value: "https://op.nodecrew.me/api"
|
|
||||||
- name: MAUTIC_CLIENT_ID
|
|
||||||
value: "2_23cgmaqef8kgg8oo4kggc0w4wccwoss8o8w48o8sc40cowgkkg"
|
|
||||||
- name: MAUTIC_CLIENT_SECRET
|
|
||||||
value: "4k8367ab306co48c4c8g8sco8cgcwwww044gwccs0o0c8w4gco"
|
|
||||||
- name: MAUTIC_API_URL
|
|
||||||
value: "https://mautic.nodecrew.me"
|
|
||||||
volumeMounts:
|
|
||||||
- name: workspace
|
|
||||||
mountPath: /workspace
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 2000m
|
|
||||||
memory: 2Gi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 512Mi
|
|
||||||
containers:
|
containers:
|
||||||
- name: storefront
|
- name: storefront
|
||||||
image: node:20-slim
|
image: ghcr.io/unchainedio/manoon-headless:latest
|
||||||
workingDir: /workspace
|
|
||||||
command:
|
|
||||||
- npm
|
|
||||||
- start
|
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
env:
|
env:
|
||||||
@@ -179,10 +76,3 @@ spec:
|
|||||||
port: 3000
|
port: 3000
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
volumeMounts:
|
|
||||||
- name: workspace
|
|
||||||
mountPath: /workspace
|
|
||||||
volumes:
|
|
||||||
- name: workspace
|
|
||||||
emptyDir:
|
|
||||||
sizeLimit: 2Gi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user