Версия 0.5.9 Исправлен Dockerfile с учетом структуры проекта.

This commit is contained in:
anibilag 2025-07-17 20:03:29 +03:00
parent a57a8656be
commit 31a8d1f7d2
2 changed files with 20 additions and 16 deletions

View File

@ -1,48 +1,52 @@
# Multi-stage build for production
# Stage 1: Frontend build
FROM node:20-alpine AS frontend-build
WORKDIR /app/frontend
WORKDIR /app
# Копируем только frontend-зависимости
COPY package*.json ./
RUN npm ci
# Копируем весь проект (vite.config.ts, src/, public/, и т.д.)
COPY . .
# Сборка фронтенда
RUN npm run build
# Backend build stage
# Stage 2: Backend build
FROM node:20-alpine AS backend-build
WORKDIR /app/backend
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
# Копируем сервер
COPY server/ ./server/
COPY package.json ./
# Production stage
# Stage 3: Final production image
FROM node:20-alpine AS production
WORKDIR /app
# Install backend dependencies
# Установка production-зависимостей
COPY package*.json ./
RUN npm ci --only=production && npm cache clean --force
# Copy backend files
# Копируем backend
COPY server/ ./server/
# Copy built frontend files
COPY --from=frontend-build /app/frontend/dist ./public
# Копируем собранный frontend
COPY --from=frontend-build /app/dist ./public
# Create uploads directory
# Создаём каталог для загрузок
RUN mkdir -p uploads
# Create non-root user
# Создаём non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
# Change ownership of app directory
RUN chown -R nodejs:nodejs /app
USER nodejs
EXPOSE 3001
CMD ["node", "server/index.js"]
CMD ["node", "server/index.js"]

View File

@ -1,7 +1,7 @@
{
"name": "lawn-mowing-scheduler",
"private": true,
"version": "0.5.8",
"version": "0.5.9",
"type": "module",
"scripts": {
"dev": "concurrently \"npm run server\" \"npm run client\"",