Update Dockerfile
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -3,29 +3,38 @@ FROM node:22-alpine AS builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm i ---force
|
RUN npm install --force
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Default html tozalaymiz
|
||||||
RUN rm -rf /usr/share/nginx/html/*
|
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 rm /etc/nginx/conf.d/default.conf
|
||||||
RUN echo 'server { \
|
|
||||||
listen 80; \
|
# nginx.conf ni bevosita Dockerfile ichida yozamiz
|
||||||
server_name _; \
|
RUN printf '%s\n' \
|
||||||
root /usr/share/nginx/html; \
|
'server {' \
|
||||||
index index.html; \
|
' listen 80;' \
|
||||||
location / { \
|
' server_name _;' \
|
||||||
try_files $uri /index.html; \
|
'' \
|
||||||
} \
|
' root /usr/share/nginx/html;' \
|
||||||
error_page 404 /index.html; \
|
' index index.html;' \
|
||||||
}' > /etc/nginx/conf.d/default.conf
|
'' \
|
||||||
|
' location / {' \
|
||||||
|
' try_files $uri $uri/ /index.html;' \
|
||||||
|
' }' \
|
||||||
|
'}' \
|
||||||
|
> /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
Reference in New Issue
Block a user