WORKKKKKKKS ; Page loading works really well now. If anything goes wrong revert to this commit

This commit is contained in:
2025-06-18 16:39:43 +02:00
parent 7d4e5b226f
commit dd10624ce4
7 changed files with 65 additions and 17 deletions

View File

@@ -1,23 +1,11 @@
# Use the official Node.js image as the base image
FROM node:14
FROM node:20-alpine
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Expose the port the app runs on
EXPOSE 8080
# Start the application
CMD ["npm", "start"]

View File

@@ -3,9 +3,6 @@ const nextConfig = {
output: 'standalone',
reactStrictMode: true,
swcMinify: true,
server: {
port: 8080,
},
}
module.exports = nextConfig

14
pm2.config.js Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
apps: [
{
name: "markdownblog-dev",
script: "npm",
args: "run dev",
watch: true,
env: {
NODE_ENV: "development",
PORT: 8080
}
}
]
};

View File

@@ -1,3 +1,5 @@
export const dynamic = "force-dynamic";
import { NextResponse } from 'next/server';
import fs from 'fs';
import path from 'path';

View File

@@ -1,3 +1,5 @@
export const dynamic = "force-dynamic";
import { NextResponse } from 'next/server';
import fs from 'fs';
import path from 'path';

View File

@@ -68,6 +68,19 @@ export default function RootLayout({
</div>
</header>
{children}
<footer className="bg-gray-100 p-4">
<div className="container mx-auto flex flex-col md:flex-row justify-between items-center">
<p>
<span>
&copy; {new Date().getFullYear()} {blogOwner}
</span>
<span className="text-gray-500 text-right" style={{ fontSize: '12px' }}>
Du bist auf dem Development-Server.
Er ist nicht stabil und kann sich jederzeit ändern.
</span>
</p>
</div>
</footer>
</body>
</html>
);

32
start_pm2.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Check the command line argument
case "$1" in
autodeploy)
echo "Starting PM2 with auto-deployment..."
pm2 start pm2.config.js
;;
prod)
echo "Starting PM2 with production build..."
NODE_ENV=production pm2 start pm2.config.js
;;
stop)
echo "Stopping PM2 process..."
pm2 stop all
;;
restart)
echo "Restarting PM2 process..."
pm2 restart all
;;
status)
echo "Showing PM2 process status..."
pm2 status
;;
logs)
echo "Showing PM2 logs..."
pm2 logs
;;
*)
echo "Usage: ./start_pm2 {autodeploy|prod|stop|restart|status|logs}"
;;
esac