From c698deea10d3f5f314021c44652297038bd6bbdd Mon Sep 17 00:00:00 2001 From: xoliqberdiyev Date: Thu, 25 Dec 2025 10:38:12 +0000 Subject: [PATCH] Update Dockerfile --- Dockerfile | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 04c3c0f..e5797ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,29 +3,38 @@ FROM node:22-alpine AS builder WORKDIR /app COPY package*.json ./ -RUN npm i ---force +RUN npm install --force COPY . . RUN npm run build + FROM nginx:alpine +# Default html tozalaymiz RUN rm -rf /usr/share/nginx/html/* -COPY --from=builder /app/.next /usr/share/nginx/html +# ❗ MUHIM: .next emas, out papka +COPY --from=builder /app/out /usr/share/nginx/html +# Default nginx configni o‘chiramiz RUN rm /etc/nginx/conf.d/default.conf -RUN echo 'server { \ - listen 80; \ - server_name _; \ - root /usr/share/nginx/html; \ - index index.html; \ - location / { \ - try_files $uri /index.html; \ - } \ - error_page 404 /index.html; \ -}' > /etc/nginx/conf.d/default.conf + +# nginx.conf ni bevosita Dockerfile ichida yozamiz +RUN printf '%s\n' \ +'server {' \ +' listen 80;' \ +' server_name _;' \ +'' \ +' root /usr/share/nginx/html;' \ +' index index.html;' \ +'' \ +' location / {' \ +' try_files $uri $uri/ /index.html;' \ +' }' \ +'}' \ +> /etc/nginx/conf.d/default.conf EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"]