feat(admin): integrate Next.js admin panel (admin-next/) from feat/nextjs-admin
- Add admin-next/: full Next.js + Prisma + shadcn admin panel (45 API routes, 76 components) - docker-compose: tg_shop_admin service (port 3000, shared db/shop.db, prisma), bot talks to it via ADMIN_CHAT_URL=http://tg_shop_admin:3000/api/chat - tor-proxy now proxies onion admin to tg_shop_admin:3000 (new panel) - chatbotService: ADMIN_CHAT_URL default = http://tg_shop_admin:3000/api/chat (removed localhost:3100 anachronism) - .env admin secrets gitignored (admin-next/.env)
This commit is contained in:
59
admin-next/Dockerfile
Normal file
59
admin-next/Dockerfile
Normal file
@@ -0,0 +1,59 @@
|
||||
# --- Stage 1: Build ---
|
||||
FROM node:22-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install bun for faster installs
|
||||
RUN npm install -g bun
|
||||
|
||||
# Install dependencies
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Copy source
|
||||
COPY prisma ./prisma/
|
||||
COPY tsconfig.json next.config.ts postcss.config.mjs tailwind.config.ts components.json ./
|
||||
COPY public ./public/
|
||||
COPY src ./src/
|
||||
|
||||
# Generate Prisma client
|
||||
RUN npx prisma generate
|
||||
|
||||
# Build Next.js (output: standalone)
|
||||
RUN npx next build
|
||||
|
||||
# Copy static assets into standalone
|
||||
RUN cp -r .next/static .next/standalone/.next/ && \
|
||||
cp -r public .next/standalone/
|
||||
|
||||
# --- Stage 2: Production ---
|
||||
FROM node:22-slim AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy standalone output
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
|
||||
# Copy static files
|
||||
COPY --from=builder /app/.next/standalone/.next ./.next
|
||||
|
||||
# Copy Prisma schema for potential migrations
|
||||
COPY --from=builder /app/prisma ./prisma/
|
||||
|
||||
# Create db directory
|
||||
RUN mkdir -p /app/db && chown nextjs:nodejs /app/db
|
||||
|
||||
# Switch to non-root
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user