Merge pull request 'исправил docker, добавил gockerignore' (#11) from dev into main

Reviewed-on: https://git.rustprogersteam.ru/PVHProject/PVHFrontend/pulls/11
This commit was merged in pull request #11.
This commit is contained in:
Joe_Peach committed 2026-04-02 08:46:39 +00:00
commit 79167c37ca
2 files changed
+37 -5

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
node_modules
.forgejo
dist
.git
.env*
*.log
.DS_Store
coverage
.vite
+28 -5
View File
@@ -1,10 +1,33 @@
FROM mkenney/npm:node-11-alpine
# ========== СТАДИЯ 1: СБОРКА ==========
FROM node:20-alpine AS builder
WORKDIR /web/app
WORKDIR /app
# Копируем зависимости
COPY package*.json ./
RUN npm ci
# Копируем исходники
COPY . .
RUN npm install
RUN npm cache clean --force
# Сборка проекта
RUN npm run build
CMD ["npm", "run", "dev"]
# ========== СТАДИЯ 2: СЕРВЕР ==========
FROM nginx:alpine
# Копируем собранные файлы из стадии 1
COPY --from=builder /app/dist /usr/share/nginx/html
# Конфиг для SPA (чтобы react-router работал)
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]