Compare commits

17 Commits

Author SHA1 Message Date
DanielS
e1a555d4f9 Fix duplicate next.config copy in Dockerfile
Some checks failed
Staging Build / build (push) Failing after 1m30s
2026-06-22 23:29:29 +02:00
DanielS
8bf59b20f6 Make public copy flexible with wildcard in Dockerfile 2026-06-22 23:29:06 +02:00
DanielS
3bc7c6ad3b Make Dockerfile tolerant to missing config files
Some checks failed
Staging Build / build (push) Failing after 1m32s
2026-06-22 23:24:58 +02:00
DanielS
65e133a391 fix staging build yaml
Some checks failed
Staging Build / build (push) Failing after 1m45s
2026-06-22 23:18:41 +02:00
DanielS
7ab0c28f6f fix staging build yaml docker build image
Some checks failed
Staging Build / build (push) Failing after 29s
2026-06-22 23:14:22 +02:00
DanielS
c187c1dc60 fix dockerfile position
Some checks failed
Staging Build / build (push) Failing after 28s
2026-06-22 23:10:58 +02:00
DanielS
9ddf5faf66 change from GITEA to REGISTRY for build server secrets
Some checks failed
Staging Build / build (push) Failing after 41s
2026-06-22 23:05:13 +02:00
DanielS
f11322e98d ci: fix docker login command and update deployment paths
Some checks failed
Staging Build / build (push) Failing after 31s
2026-06-22 22:45:20 +02:00
DanielS
126de81834 add container for build server
Some checks failed
Staging Build / build (push) Failing after 1m22s
2026-06-22 22:41:04 +02:00
DanielS
7bb6807d37 Fix global error page, update CI workflow, add Dockerfile
Some checks failed
Staging Build / build (push) Failing after 34s
2026-06-22 22:30:55 +02:00
DanielS
3eb72481ce Add key props to recent orders list rendering
Some checks failed
Staging Build / build (push) Failing after 26s
2026-06-22 22:25:21 +02:00
DanielS
2403408b6c Fix React key props in order and my-orders pages 2026-06-22 22:24:21 +02:00
DanielS
f91499861e fix: korrigiere workflow syntax
Some checks failed
Staging Build / build (push) Failing after 28s
2026-06-22 21:41:42 +02:00
DanielS
84ced5a170 remove unused build config
Some checks failed
Staging Build / build (push) Failing after 2s
2026-06-22 21:38:57 +02:00
DanielS
d7a45576b2 build server test
Some checks failed
Staging Build / build (push) Failing after 1m1s
2026-06-22 21:32:53 +02:00
DanielS
dedf1945ef correct build server config
Some checks failed
Staging Build / build (push) Failing after 24s
2026-06-22 21:27:06 +02:00
e6913c03f5 Merge pull request 'develop build server' (#1) from develop into staging
Some checks failed
Staging Build / build (push) Failing after 48s
Reviewed-on: #1
2026-06-22 21:24:09 +02:00
6 changed files with 117 additions and 7 deletions

View File

@@ -7,6 +7,11 @@ on:
jobs:
build:
runs-on: webserver
container:
image: catthehacker/ubuntu:act-latest
defaults:
run:
working-directory: shop
steps:
- name: Code auschecken
uses: actions/checkout@v4
@@ -15,4 +20,33 @@ jobs:
run: npm install
- 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
View File

@@ -0,0 +1,48 @@
# Use a multistage 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"]

View 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>
)
}

View File

@@ -113,7 +113,7 @@ export default async function MyOrdersPage() {
<div className="flex flex-wrap gap-2">
{items.map((item, i) => (
<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"
>
{item.product_name}

View File

@@ -79,8 +79,8 @@ export default async function OrderSuccessPage({
<CardContent className="space-y-4">
{/* Produkte */}
<div className="space-y-3">
{items.map((item, i) => (
<div key={i} className="space-y-1">
{items.map((item) => (
<div key={item.product_id} className="space-y-1">
<div className="flex justify-between text-sm">
<span className="font-semibold text-white">{item.product_name}</span>
<span className="text-white">
@@ -90,8 +90,8 @@ export default async function OrderSuccessPage({
</span>
</span>
</div>
{item.selected_modules.map((mod, j) => (
<div key={j} className="flex justify-between text-xs pl-4 text-slate-400">
{item.selected_modules.map((mod) => (
<div key={mod.module_id} className="flex justify-between text-xs pl-4 text-slate-400">
<span>+ {mod.module_name}</span>
<span>{new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(mod.price)}</span>
</div>

View File

@@ -40,7 +40,8 @@ export function AdminRecentOrders() {
const fetchOrders = async () => {
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
const { orders: fresh } = await res.json()