Версия 0.5.9 Исправлен Dockerfile с учетом структуры проекта.
This commit is contained in:
parent
a57a8656be
commit
31a8d1f7d2
32
Dockerfile
32
Dockerfile
@ -1,45 +1,49 @@
|
|||||||
# Multi-stage build for production
|
# Stage 1: Frontend build
|
||||||
FROM node:20-alpine AS frontend-build
|
FROM node:20-alpine AS frontend-build
|
||||||
|
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Копируем только frontend-зависимости
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
|
# Копируем весь проект (vite.config.ts, src/, public/, и т.д.)
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Сборка фронтенда
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Backend build stage
|
# Stage 2: Backend build
|
||||||
FROM node:20-alpine AS backend-build
|
FROM node:20-alpine AS backend-build
|
||||||
|
|
||||||
WORKDIR /app/backend
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci --only=production
|
RUN npm ci --only=production
|
||||||
|
|
||||||
|
# Копируем сервер
|
||||||
COPY server/ ./server/
|
COPY server/ ./server/
|
||||||
COPY package.json ./
|
|
||||||
|
|
||||||
# Production stage
|
# Stage 3: Final production image
|
||||||
FROM node:20-alpine AS production
|
FROM node:20-alpine AS production
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install backend dependencies
|
# Установка production-зависимостей
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci --only=production && npm cache clean --force
|
RUN npm ci --only=production && npm cache clean --force
|
||||||
|
|
||||||
# Copy backend files
|
# Копируем backend
|
||||||
COPY server/ ./server/
|
COPY server/ ./server/
|
||||||
|
|
||||||
# Copy built frontend files
|
# Копируем собранный frontend
|
||||||
COPY --from=frontend-build /app/frontend/dist ./public
|
COPY --from=frontend-build /app/dist ./public
|
||||||
|
|
||||||
# Create uploads directory
|
# Создаём каталог для загрузок
|
||||||
RUN mkdir -p uploads
|
RUN mkdir -p uploads
|
||||||
|
|
||||||
# Create non-root user
|
# Создаём non-root user
|
||||||
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
|
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
|
||||||
|
|
||||||
# Change ownership of app directory
|
|
||||||
RUN chown -R nodejs:nodejs /app
|
RUN chown -R nodejs:nodejs /app
|
||||||
USER nodejs
|
USER nodejs
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lawn-mowing-scheduler",
|
"name": "lawn-mowing-scheduler",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.8",
|
"version": "0.5.9",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"npm run server\" \"npm run client\"",
|
"dev": "concurrently \"npm run server\" \"npm run client\"",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user