Compare commits
17 Commits
develop
...
e1a555d4f9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a555d4f9 | ||
|
|
8bf59b20f6 | ||
|
|
3bc7c6ad3b | ||
|
|
65e133a391 | ||
|
|
7ab0c28f6f | ||
|
|
c187c1dc60 | ||
|
|
9ddf5faf66 | ||
|
|
f11322e98d | ||
|
|
126de81834 | ||
|
|
7bb6807d37 | ||
|
|
3eb72481ce | ||
|
|
2403408b6c | ||
|
|
f91499861e | ||
|
|
84ced5a170 | ||
|
|
d7a45576b2 | ||
|
|
dedf1945ef | ||
| e6913c03f5 |
@@ -7,6 +7,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: webserver
|
runs-on: webserver
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: shop
|
||||||
steps:
|
steps:
|
||||||
- name: Code auschecken
|
- name: Code auschecken
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -15,4 +20,33 @@ jobs:
|
|||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Staging-Build generieren
|
- name: Staging-Build generieren
|
||||||
run: npm run build -- --configuration=staging
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Docker login to Gitea registry
|
||||||
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.hephex.de -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
|
# KORREKTUR: Wir nutzen das gesetzte working-directory (shop) und bauen direkt dort
|
||||||
|
# KORREKTUR: Wir springen für Docker ganz nach außen und sagen ihm, wo der shop-Ordner liegt
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t gitea.hephex.de/daniel/webshop:staging -f Dockerfile .
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
|
# KORREKTUR: Auch der Push wird vom Hauptordner aus gestartet
|
||||||
|
- name: Push Docker image
|
||||||
|
run: docker push gitea.hephex.de/daniel/webshop:staging
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
|
|
||||||
|
# KORREKTUR: IP-Adresse exakt auf Ihren Proxmox-Staging-Container eingestellt
|
||||||
|
- name: Deploy to Proxmox LXC via SSH
|
||||||
|
uses: appleboy/ssh-action@v0.1.5
|
||||||
|
with:
|
||||||
|
host: 192.168.1.132
|
||||||
|
username: ${{ secrets.PROXMOX_USER }}
|
||||||
|
key: ${{ secrets.PROXMOX_SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
cd /opt/webshop/supabase/supabase-project
|
||||||
|
docker compose pull webshop
|
||||||
|
docker compose up -d webshop
|
||||||
|
|||||||
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Use a multi‑stage build for a Next.js app
|
||||||
|
|
||||||
|
# ---------- Builder stage ----------
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies (use package lock when present)
|
||||||
|
COPY shop/package*.json ./
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
# Copy the source code
|
||||||
|
COPY shop/ .
|
||||||
|
|
||||||
|
# Build the production output
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ---------- Runtime stage ----------
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy only built assets and runtime dependencies
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
|
||||||
|
# KORREKTUR: Kopiert den public-Ordner nur, wenn er wirklich existiert
|
||||||
|
COPY --from=builder /app/public* ./public
|
||||||
|
|
||||||
|
COPY --from=builder /app/package*.json ./
|
||||||
|
# KORREKTUR: Flexibles Kopieren der Next-Konfiguration (egal ob .js oder .mjs)
|
||||||
|
COPY --from=builder /app/next.config.* ./
|
||||||
|
# Optionale TS-Dateien (nur kopieren, wenn vorhanden, blockiert den Build nicht mehr)
|
||||||
|
COPY --from=builder /app/tsconfig.json ./ 2>/dev/null || true
|
||||||
|
COPY --from=builder /app/next-env.d.ts ./ 2>/dev/null || true
|
||||||
|
COPY --from=builder /app/tsconfig.json ./ 2>/dev/null || true
|
||||||
|
COPY --from=builder /app/next-env.d.ts ./ 2>/dev/null || true
|
||||||
|
# Install production dependencies (already installed in builder, but ensure they are present)
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the Next.js server
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
27
shop/app/_global-error.tsx
Normal file
27
shop/app/_global-error.tsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
export default function GlobalError({ error, reset }: { error: Error; reset: () => void }) {
|
||||||
|
// Ensure the page does not depend on any context or Supabase client.
|
||||||
|
useEffect(() => {
|
||||||
|
console.error('Global error caught:', error)
|
||||||
|
}, [error])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-[#020617] text-white flex items-center justify-center p-8">
|
||||||
|
<div className="max-w-lg space-y-4 text-center">
|
||||||
|
<h1 className="text-4xl font-extrabold">Ein unerwarteter Fehler ist aufgetreten</h1>
|
||||||
|
<p className="text-slate-300">
|
||||||
|
Bitte versuchen Sie die Seite zu aktualisieren oder kontaktieren Sie den Support.
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
onClick={reset}
|
||||||
|
className="mt-4 px-6 py-2 bg-primary text-white rounded hover:bg-primary/90"
|
||||||
|
>
|
||||||
|
Seite neu laden
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -113,7 +113,7 @@ export default async function MyOrdersPage() {
|
|||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
{items.map((item, i) => (
|
{items.map((item, i) => (
|
||||||
<span
|
<span
|
||||||
key={i}
|
key={item.product_id}
|
||||||
className="text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1 text-slate-300"
|
className="text-xs bg-white/5 border border-white/10 rounded-full px-3 py-1 text-slate-300"
|
||||||
>
|
>
|
||||||
{item.product_name}
|
{item.product_name}
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ export default async function OrderSuccessPage({
|
|||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
{/* Produkte */}
|
{/* Produkte */}
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{items.map((item, i) => (
|
{items.map((item) => (
|
||||||
<div key={i} className="space-y-1">
|
<div key={item.product_id} className="space-y-1">
|
||||||
<div className="flex justify-between text-sm">
|
<div className="flex justify-between text-sm">
|
||||||
<span className="font-semibold text-white">{item.product_name}</span>
|
<span className="font-semibold text-white">{item.product_name}</span>
|
||||||
<span className="text-white">
|
<span className="text-white">
|
||||||
@@ -90,8 +90,8 @@ export default async function OrderSuccessPage({
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{item.selected_modules.map((mod, j) => (
|
{item.selected_modules.map((mod) => (
|
||||||
<div key={j} className="flex justify-between text-xs pl-4 text-slate-400">
|
<div key={mod.module_id} className="flex justify-between text-xs pl-4 text-slate-400">
|
||||||
<span>+ {mod.module_name}</span>
|
<span>+ {mod.module_name}</span>
|
||||||
<span>{new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(mod.price)}</span>
|
<span>{new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(mod.price)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export function AdminRecentOrders() {
|
|||||||
|
|
||||||
const fetchOrders = async () => {
|
const fetchOrders = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/admin/recent-orders', { cache: 'no-store' })
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
|
||||||
|
const res = await fetch(`${baseUrl}/api/admin/recent-orders`, { cache: 'no-store' });
|
||||||
if (!res.ok) return
|
if (!res.ok) return
|
||||||
const { orders: fresh } = await res.json()
|
const { orders: fresh } = await res.json()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user