Fix global error page, update CI workflow, add Dockerfile
Some checks failed
Staging Build / build (push) Failing after 34s
Some checks failed
Staging Build / build (push) Failing after 34s
This commit is contained in:
@@ -19,5 +19,25 @@ jobs:
|
||||
|
||||
- name: Staging-Build generieren
|
||||
env:
|
||||
NODE_ENV: development
|
||||
NODE_ENV: production
|
||||
run: npm run build
|
||||
|
||||
- name: Docker login to Gitea registry
|
||||
run: echo ${{ secrets.GITEA_TOKEN }} | docker login gitea.hephex.de -u ${{ secrets.GITEA_USER }} --password-stdin
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
- name: Build Docker image
|
||||
run: docker build -t gitea.hephex.de/daniel/webshop:staging .
|
||||
working-directory: ..
|
||||
- name: Push Docker image
|
||||
run: docker push gitea.hephex.de/daniel/webshop:staging
|
||||
working-directory: ..
|
||||
- name: Deploy to Proxmox LXC via SSH
|
||||
uses: appleboy/ssh-action@v0.1.5
|
||||
with:
|
||||
host: 192.168.1.51
|
||||
username: ${{ secrets.PROXMOX_USER }}
|
||||
key: ${{ secrets.PROXMOX_SSH_KEY }}
|
||||
script: |
|
||||
cd /path/to/deployment
|
||||
docker compose pull webshop && docker compose up -d webshop
|
||||
|
||||
42
Dockerfile
Normal file
42
Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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 the built assets and runtime dependencies from the builder
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package*.json ./
|
||||
COPY --from=builder /app/next.config.mjs ./
|
||||
COPY --from=builder /app/next-env.d.ts ./
|
||||
COPY --from=builder /app/tsconfig.json ./
|
||||
|
||||
# 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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user