gateway issue
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,26 +1,12 @@
|
|||||||
FROM node:20-alpine
|
FROM nginx:alpine
|
||||||
|
# Move to Nginx's public folder
|
||||||
WORKDIR /app
|
WORKDIR /usr/share/nginx/html
|
||||||
|
# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely
|
||||||
# Next.js standalone runtime. Required because the contact form's Server
|
RUN rm -rf ./*
|
||||||
# Action (sendEmail.ts, SMTP via nodemailer) needs a live Node process -
|
# 2. Copy your compiled static assets into the root folder.
|
||||||
# it cannot run under static/nginx serving.
|
# NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/"
|
||||||
ENV NODE_ENV=production
|
COPY build/ .
|
||||||
ENV PORT=3000
|
# 3. Copy your custom Nginx configuration (which you already have in your log)
|
||||||
ENV HOSTNAME=0.0.0.0
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
EXPOSE 80
|
||||||
# Copy the standalone build artifact (server.js, .next/, public/)
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
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"]
|
|
||||||
@@ -1,19 +1,15 @@
|
|||||||
events {}
|
events {}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
# Next.js static export creates page.html (e.g. contact.html) for routes.
|
# This line forces Nginx to pass routing back to React Router
|
||||||
# We check $uri.html to allow clean URLs without the .html extension.
|
try_files $uri $uri/ /index.html;
|
||||||
try_files $uri $uri.html $uri/ /404.html;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user