This commit is contained in:
Bivekich
2025-08-06 12:51:55 +03:00
parent 162d96e9aa
commit 8ee7bc896d
4 changed files with 67 additions and 4 deletions

View File

@ -7,8 +7,14 @@ WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Install all dependencies (including dev dependencies for build)
RUN npm ci
# Copy prisma schema
COPY prisma ./prisma/
# Generate Prisma client
RUN npx prisma generate
# Copy project files
COPY . .
@ -23,11 +29,22 @@ WORKDIR /app
ENV NODE_ENV=production
# Create non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy necessary files from builder
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/prisma ./prisma
# Set correct permissions
RUN chown -R nextjs:nodejs /app
USER nextjs
EXPOSE 3000

View File

@ -6,7 +6,23 @@ services:
context: .
dockerfile: Dockerfile
ports:
- "3006:3000"
- "${PORT:-3006}:3000"
environment:
- NODE_ENV=production
- NODE_ENV=${NODE_ENV:-production}
- DATABASE_URL=${DATABASE_URL}
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_REGION=${S3_REGION}
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID}
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
- S3_BUCKET_NAME=${S3_BUCKET_NAME}
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
- NEXTAUTH_URL=${NEXTAUTH_URL}
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

View File

@ -23,6 +23,7 @@ const nextConfig = {
},
],
},
output: 'standalone',
};
module.exports = nextConfig;

29
stack.env Normal file
View File

@ -0,0 +1,29 @@
# ====================================================================
# STACK ENVIRONMENT VARIABLES FOR DEPLOYMENT
# ====================================================================
# Port configuration
PORT=3006
# Environment
NODE_ENV=production
# Database configuration
DATABASE_URL=postgresql://ckeproekt:y0i_-yCfeL@85.234.110.60:5432/ckeproekt
# Authentication & Security
NEXTAUTH_SECRET=15455c6e0f1e5aa95945e23a591acbd0baf11c1589e08c36d95afefa496e6a64510ee98dbf9a4afade12bec2cb3a4d1e0e9b238048c8cef927c9ce568ea4a0a7
# S3 Storage Configuration
S3_ENDPOINT=https://s3.twcstorage.ru
S3_REGION=ru-1
S3_ACCESS_KEY_ID=I6XD2OR7YO2ZN6L6Z629
S3_SECRET_ACCESS_KEY=9xCOoafisG0aB9lJNvdLO1UuK73fBvMcpHMdijrJ
S3_BUCKET_NAME=617774af-ckeproekt
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=7802786776:AAGQGYf2BxuBFmZOhRcLTX52KnUEYifTKZY
TELEGRAM_CHAT_ID=-1002321880357
# Next.js URL (update with your domain)
NEXTAUTH_URL=https://ckeproekt.ru