WORKKKKKKKS ; Page loading works really well now. If anything goes wrong revert to this commit
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -1,23 +1,11 @@
|
|||||||
# Use the official Node.js image as the base image
|
FROM node:20-alpine
|
||||||
FROM node:14
|
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package.json and package-lock.json
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
CMD ["npm", "start"]
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Expose the port the app runs on
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
# Start the application
|
|
||||||
CMD ["npm", "start"]
|
|
||||||
@@ -3,9 +3,6 @@ const nextConfig = {
|
|||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
swcMinify: true,
|
swcMinify: true,
|
||||||
server: {
|
|
||||||
port: 8080,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = nextConfig
|
module.exports = nextConfig
|
||||||
14
pm2.config.js
Normal file
14
pm2.config.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
name: "markdownblog-dev",
|
||||||
|
script: "npm",
|
||||||
|
args: "run dev",
|
||||||
|
watch: true,
|
||||||
|
env: {
|
||||||
|
NODE_ENV: "development",
|
||||||
|
PORT: 8080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|||||||
@@ -68,6 +68,19 @@ export default function RootLayout({
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{children}
|
{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>
|
||||||
|
© {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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
32
start_pm2.sh
Executable file
32
start_pm2.sh
Executable 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
|
||||||
Reference in New Issue
Block a user