41 lines
728 B
Docker
41 lines
728 B
Docker
FROM node:22-alpine AS builder
|
||
|
||
WORKDIR /app
|
||
|
||
COPY package*.json ./
|
||
RUN npm install --force
|
||
|
||
COPY . .
|
||
RUN npm run build
|
||
|
||
|
||
FROM nginx:alpine
|
||
|
||
# Default html tozalaymiz
|
||
RUN rm -rf /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
|
||
|
||
# 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;"]
|