feat: update Next.js configuration and dependencies, add Docker support

- Set output mode to "standalone" in next.config.ts
- Update dependencies in package.json:
  - Upgrade @heroui/react to ^2.8.5
  - Upgrade framer-motion to ^12.23.25
  - Upgrade next to 16.0.7
  - Upgrade react and react-dom to 19.2.1
  - Upgrade undici to ^7.16.0
  - Upgrade devDependencies including @biomejs/biome, @tailwindcss/postcss, and typescript
- Modify error handling in API routes to simplify catch blocks
- Refactor NotFound component for cleaner JSX structure
- Update global CSS imports for consistency
- Change tsconfig to use "react-jsx" for JSX and include additional type definitions
- Add GitHub Actions workflow for Docker image build and push
- Create Dockerfile for multi-stage build process
- Add development and production Docker Compose configurations

ai commit message xd
This commit is contained in:
2025-12-06 01:41:00 +01:00
parent d33cff7063
commit cf243d46f1
14 changed files with 455 additions and 386 deletions
+64
View File
@@ -0,0 +1,64 @@
name: Docker
on:
push:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.5.0
with:
cosign-release: 'v2.1.1'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
+28
View File
@@ -0,0 +1,28 @@
FROM oven/bun:1 AS base
WORKDIR /app
FROM base AS deps
COPY package.json bun.lock* ./
RUN bun install --no-save --frozen-lockfile
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN bun run build
FROM base AS runner
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production \
PORT=3000 \
HOSTNAME="0.0.0.0"
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
CMD ["bun", "./server.js"]
+11 -3
View File
@@ -1,5 +1,5 @@
{ {
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json", "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"vcs": { "vcs": {
"enabled": true, "enabled": true,
"clientKind": "git", "clientKind": "git",
@@ -10,8 +10,7 @@
}, },
"formatter": { "formatter": {
"enabled": true, "enabled": true,
"indentStyle": "tab", "indentStyle": "tab"
"lineWidth": 80
}, },
"linter": { "linter": {
"enabled": true, "enabled": true,
@@ -20,8 +19,17 @@
} }
}, },
"javascript": { "javascript": {
"formatter": {
"quoteStyle": "double",
"jsxQuoteStyle": "double"
}
},
"css": {
"formatter": { "formatter": {
"quoteStyle": "double" "quoteStyle": "double"
},
"parser": {
"tailwindDirectives": true
} }
}, },
"assist": { "assist": {
+296 -341
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
services:
erettsegi-browser:
build: .
container_name: erettsegi-browser
ports:
- "3000:3000"
+7
View File
@@ -0,0 +1,7 @@
services:
erettsegi-browser:
image: ghcr.io/skidoodle/erettsegi-browser:main
container_name: erettsegi-browser
restart: unless-stopped
ports:
- "3000:3000"
+1
View File
@@ -50,6 +50,7 @@ const nextConfig: NextConfig = {
}, },
reactStrictMode: true, reactStrictMode: true,
poweredByHeader: false, poweredByHeader: false,
output: "standalone",
}; };
export default nextConfig; export default nextConfig;
+16 -16
View File
@@ -5,32 +5,32 @@
"author": "albert|skidoodle@gh", "author": "albert|skidoodle@gh",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"dev": "next dev --turbopack", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "biome lint --write", "lint": "biome lint --write",
"format": "biome format --write" "format": "biome format --write"
}, },
"dependencies": { "dependencies": {
"@heroui/react": "^2.8.0-beta.9", "@heroui/react": "^2.8.5",
"framer-motion": "^12.18.1", "framer-motion": "^12.23.25",
"next": "15.4.8", "next": "16.0.7",
"next-themes": "^0.4.6", "next-themes": "^0.4.6",
"react": "19.1.0", "react": "19.2.1",
"react-dom": "19.1.0", "react-dom": "19.2.1",
"react-icons": "^5.5.0", "react-icons": "^5.5.0",
"undici": "^7.10.0" "undici": "^7.16.0"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "2.0.0", "@biomejs/biome": "2.3.8",
"@tailwindcss/postcss": "^4.1.10", "@tailwindcss/postcss": "^4.1.17",
"@types/node": "24.0.3", "@types/node": "24.10.1",
"@types/react": "19.1.8", "@types/react": "19.2.7",
"@types/react-dom": "19.1.6", "@types/react-dom": "19.2.3",
"postcss": "8.5.6", "postcss": "8.5.6",
"prettier": "^3.5.3", "prettier": "^3.7.4",
"prettier-plugin-tailwindcss": "^0.6.13", "prettier-plugin-tailwindcss": "^0.7.2",
"tailwindcss": "^4.1.10", "tailwindcss": "^4.1.17",
"typescript": "5.8.3" "typescript": "5.9.3"
} }
} }
+1 -1
View File
@@ -27,7 +27,7 @@ export async function GET(req: NextRequest) {
let url: URL; let url: URL;
try { try {
url = new URL(link); url = new URL(link);
} catch (_error) { } catch {
return NextResponse.json( return NextResponse.json(
{ error: "Érvénytelen link formátum" }, { error: "Érvénytelen link formátum" },
{ status: 400 }, { status: 400 },
+1 -1
View File
@@ -34,7 +34,7 @@ export async function GET(req: NextRequest) {
let url: URL; let url: URL;
try { try {
url = new URL(link); url = new URL(link);
} catch (_error) { } catch {
return NextResponse.json( return NextResponse.json(
{ error: "Érvénytelen link formátum" }, { error: "Érvénytelen link formátum" },
{ status: 400 }, { status: 400 },
+13 -15
View File
@@ -6,21 +6,19 @@ import Link from "next/link";
export default function NotFound() { export default function NotFound() {
return ( return (
<> <main className="dark:bg-[#121212] text-foreground bg-background py-5">
<main className="dark:bg-[#121212] text-foreground bg-background py-5"> <div className="flex min-h-screen flex-col items-center justify-center">
<div className="flex min-h-screen flex-col items-center justify-center"> <h1 className="text-7xl font-bold text-blue-400">404</h1>
<h1 className="text-7xl font-bold text-blue-400">404</h1> <div className="mt-5 mb-3 text-center">
<div className="mt-5 mb-3 text-center"> <p className="text-2xl font-semibold text-gray-600">
<p className="text-2xl font-semibold text-gray-600"> Az keresett oldal nem található.
Az keresett oldal nem található. </p>
</p> <Link href="/" className="mt-8 inline-block">
<Link href="/" className="mt-8 inline-block"> <Button color="primary">Vissza a főoldalra</Button>
<Button color="primary">Vissza a főoldalra</Button> </Link>
</Link>
</div>
</div> </div>
<Footer /> </div>
</main> <Footer />
</> </main>
); );
} }
+1 -1
View File
@@ -21,7 +21,7 @@ const ResourceComponent = ({ label, link }: ResourceProps) => {
const response = await fetch(`/api/validate?link=${encodeURI(link)}`); const response = await fetch(`/api/validate?link=${encodeURI(link)}`);
const data = (await response.json()) as { status: number }; const data = (await response.json()) as { status: number };
setStatus(data.status); setStatus(data.status);
} catch (_error) { } catch {
setStatus(500); setStatus(500);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
+2 -2
View File
@@ -1,7 +1,7 @@
@import "tailwindcss"; @import "tailwindcss";
@plugin './hero.ts'; @plugin "./hero.ts";
@source '../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}'; @source "../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}";
@custom-variant dark (&:is(.dark *)); @custom-variant dark (&:is(.dark *));
@layer base { @layer base {
+8 -6
View File
@@ -5,39 +5,41 @@
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"jsx": "preserve", "jsx": "react-jsx",
"incremental": true, "incremental": true,
"plugins": [ "plugins": [
{ {
"name": "next" "name": "next"
} }
], ],
/* Strictness */ /* Strictness */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
/* Module Resolution */ /* Module Resolution */
"module": "esnext", "module": "esnext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
/* Code Style */ /* Code Style */
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noEmit": true, "noEmit": true,
"esModuleInterop": true, "esModuleInterop": true,
/* Path Aliases */ /* Path Aliases */
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }