CI/CD build notifications
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-11-02 06:33:45 +09:00
parent d5f1809f5a
commit 01532e860a
10 changed files with 1104 additions and 42 deletions

View File

@@ -0,0 +1,119 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
yarn.lock
# Production build
.next/
out/
build/
dist/
# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Coverage directory used by tools like istanbul
coverage/
.nyc_output/
# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Git
.git/
.gitignore
.gitattributes
# Documentation
README.md
*.md
docs/
# CI/CD files
.drone.yml
.github/
.gitlab-ci.yml
docker-compose*.yml
Dockerfile.dev
# Testing
jest.config.js
.jest/
__tests__/
**/*.test.js
**/*.test.ts
**/*.test.tsx
**/*.spec.js
**/*.spec.ts
**/*.spec.tsx
# Linting
.eslintrc*
.eslintignore
.prettierrc*
.prettierignore
# TypeScript
*.tsbuildinfo
tsconfig.json
# Storybook
.storybook/
storybook-static/
# Temporary folders
tmp/
temp/
# Logs
logs/
*.log
# Backend files (не нужны в frontend контейнере)
backend/
*.py
*.pyc
requirements.txt
manage.py
# Development scripts
scripts/
Makefile
# Design files
design/
# Cache directories
.cache/
# Vercel
.vercel
# Turbo
.turbo

View File

@@ -0,0 +1,86 @@
# Multi-stage build для оптимального размера
FROM node:20-alpine AS base
# Установка зависимостей для сборки
RUN apk add --no-cache libc6-compat curl
# Dependencies stage
FROM base AS deps
WORKDIR /app
# Копирование файлов зависимостей
COPY package.json package-lock.json* ./
# Установка зависимостей
RUN npm ci --only=production && npm cache clean --force
# Builder stage
FROM base AS builder
WORKDIR /app
# Копирование зависимостей из предыдущего stage
COPY --from=deps /app/node_modules ./node_modules
# Копирование исходного кода
COPY . .
# Build arguments
ARG BUILD_VERSION=latest
ARG BUILD_DATE
ARG VCS_REF
ARG NEXT_PUBLIC_API_URL
# Переменные окружения для сборки
ENV NODE_ENV=production \
NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL \
BUILD_VERSION=$BUILD_VERSION
# Генерация статических файлов Next.js
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
# Build arguments для метаданных
ARG BUILD_VERSION=latest
ARG BUILD_DATE
ARG VCS_REF
# Метаданные образа
LABEL org.opencontainers.image.title="CatLink Frontend" \
org.opencontainers.image.description="Next.js приложение для CatLink" \
org.opencontainers.image.version="$BUILD_VERSION" \
org.opencontainers.image.created="$BUILD_DATE" \
org.opencontainers.image.revision="$VCS_REF" \
org.opencontainers.image.source="https://github.com/smartsoltech/links"
WORKDIR /app
# Создание пользователя приложения
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
# Копирование собранного приложения
COPY --from=builder /app/public ./public
# Копирование статических файлов
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Переменные окружения
ENV NODE_ENV=production \
PORT=3000 \
HOSTNAME="0.0.0.0"
# Переключение на пользователя приложения
USER nextjs
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:$PORT/health || exit 1
# Открытие порта
EXPOSE $PORT
# Команда запуска
CMD ["node", "server.js"]