Add Docker deployment support for Dokploy

- Add Dockerfile with multi-stage build
- Add docker-compose.yml with Traefik labels
- Add .dockerignore for optimal build context
- Update next.config.ts for standalone output
- Update DEPLOYMENT.md with Dokploy instructions

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Max
2026-01-26 12:38:37 +07:00
parent 415c39ba0a
commit b6a566db6e
5 changed files with 242 additions and 31 deletions

50
Dockerfile Normal file
View File

@@ -0,0 +1,50 @@
# Build stage
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci
# Copy all source files
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
# Set working directory
WORKDIR /app
# Set environment to production
ENV NODE_ENV=production
# Create a non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy necessary files from builder
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# Change ownership to nextjs user
RUN chown -R nextjs:nodejs /app
# Switch to nextjs user
USER nextjs
# Expose port 3000
EXPOSE 3000
# Set hostname
ENV HOSTNAME="0.0.0.0"
# Start the application
CMD ["node", "server.js"]