gateway issue
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,26 +1,12 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Next.js standalone runtime. Required because the contact form's Server
|
||||
# Action (sendEmail.ts, SMTP via nodemailer) needs a live Node process -
|
||||
# it cannot run under static/nginx serving.
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
|
||||
# Copy the standalone build artifact (server.js, .next/, public/)
|
||||
COPY build /app
|
||||
|
||||
# The standalone build was created on macOS (darwin-arm64), so it bundles
|
||||
# macOS-only native binaries for sharp (image optimisation). These crash
|
||||
# on Linux/Alpine. Replace them with the correct musl-linux-x64 binaries.
|
||||
RUN rm -rf node_modules/@img/sharp-darwin-arm64 \
|
||||
node_modules/@img/sharp-libvips-darwin-arm64 && \
|
||||
npm install --no-save --platform=linuxmusl --arch=x64 \
|
||||
@img/sharp-linuxmusl-x64@0.34.5 && \
|
||||
rm -rf /tmp/* /root/.npm
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
FROM nginx:alpine
|
||||
# Move to Nginx's public folder
|
||||
WORKDIR /usr/share/nginx/html
|
||||
# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely
|
||||
RUN rm -rf ./*
|
||||
# 2. Copy your compiled static assets into the root folder.
|
||||
# NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/"
|
||||
COPY build/ .
|
||||
# 3. Copy your custom Nginx configuration (which you already have in your log)
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,19 +1,15 @@
|
||||
events {}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
# Next.js static export creates page.html (e.g. contact.html) for routes.
|
||||
# We check $uri.html to allow clean URLs without the .html extension.
|
||||
try_files $uri $uri.html $uri/ /404.html;
|
||||
# This line forces Nginx to pass routing back to React Router
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user