From 313eb3565348d6c15bb92ff25a42368d31187bb2 Mon Sep 17 00:00:00 2001 From: vafeini <129304399+vafeini@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:24:30 +0300 Subject: [PATCH] Remove nginx (#7) * Remove nginx * Remove nginx --- Dockerfile | 16 +--------------- nginx.conf | 30 ------------------------------ package.json | 2 +- start.sh | 7 ------- 4 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 nginx.conf delete mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile index 08b1025..96918e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,25 +17,11 @@ RUN npm run build FROM node:20.15.1-alpine WORKDIR /app -# Install Nginx -RUN apk update && apk add nginx - # Copy the built Next.js app and dependencies COPY --from=builder /app/.next ./.next COPY --from=builder /app/public ./public COPY --from=builder /app/package.json ./package.json COPY --from=builder /app/node_modules ./node_modules -# Copy Nginx configuration file -COPY nginx.conf /etc/nginx/nginx.conf - -# Copy the startup script -COPY start.sh /start.sh - -RUN chmod +x /start.sh - -# Expose port 80 for Nginx -EXPOSE 80 - # Start the Next.js app and Nginx -CMD ["/start.sh"] +CMD ["npm", "start"] diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 1669116..0000000 --- a/nginx.conf +++ /dev/null @@ -1,30 +0,0 @@ -user nginx; -worker_processes auto; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - sendfile on; - keepalive_timeout 65; - - server { - listen 80; - - location / { - proxy_pass http://127.0.0.1:3000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } - } -} diff --git a/package.json b/package.json index 22ea9bd..6234bf6 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "next start", + "start": "next start -p 3000", "lint": "next lint", "prisma:push": "npx prisma db push", "prisma:deploy": "npx prisma migrate deploy", diff --git a/start.sh b/start.sh deleted file mode 100644 index 3b7f63a..0000000 --- a/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Start the Next.js app in the background -npm start & - -# Start Nginx in the foreground -nginx -g 'daemon off;' \ No newline at end of file