🚀 Initial commit: Biveki Day Bot with Docker deployment
✨ Features: - 🤖 Telegram bot for task management between programmer and girlfriend - 📝 Task creation with types (personal/shared) and priorities - ⏰ Time-based reminders and notifications - 📊 Statistics and progress tracking - 🤝 Shared tasks for couples 🛠 Tech Stack: - Backend: NestJS + TypeScript - Database: PostgreSQL + TypeORM - Bot: Telegraf - Deployment: Docker + Docker Compose 🐳 Docker Deployment: - Multi-stage Dockerfile for optimized builds - Docker Compose with environment variables - Health checks and automatic restarts - Production-ready configuration 📦 Files included: - Complete NestJS application - Docker deployment configuration - Environment variables setup - Deployment scripts and documentation - Health monitoring and logging
This commit is contained in:
45
Dockerfile
Normal file
45
Dockerfile
Normal file
@ -0,0 +1,45 @@
|
||||
# Многоступенчатая сборка для оптимизации размера образа
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
# Устанавливаем рабочую директорию
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем файлы зависимостей
|
||||
COPY package*.json ./
|
||||
|
||||
# Устанавливаем зависимости
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
# Копируем исходный код
|
||||
COPY . .
|
||||
|
||||
# Собираем приложение
|
||||
RUN npm run build
|
||||
|
||||
# Финальный образ
|
||||
FROM node:18-alpine AS production
|
||||
|
||||
# Создаем пользователя для безопасности
|
||||
RUN addgroup -g 1001 -S nodejs
|
||||
RUN adduser -S nestjs -u 1001
|
||||
|
||||
# Устанавливаем рабочую директорию
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем зависимости из builder
|
||||
COPY --from=builder --chown=nestjs:nodejs /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=nestjs:nodejs /app/dist ./dist
|
||||
COPY --from=builder --chown=nestjs:nodejs /app/package*.json ./
|
||||
|
||||
# Устанавливаем пользователя
|
||||
USER nestjs
|
||||
|
||||
# Открываем порт
|
||||
EXPOSE 3000
|
||||
|
||||
# Проверка здоровья
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
|
||||
|
||||
# Запускаем приложение
|
||||
CMD ["npm", "run", "start:prod"]
|
Reference in New Issue
Block a user