Add Docker support and notification URL enhancement
This commit is contained in:
45
Dockerfile
Normal file
45
Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
||||
# Build Stage
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
COPY package*.json ./
|
||||
COPY prisma ./prisma/
|
||||
RUN npm install
|
||||
|
||||
# Build the application
|
||||
COPY . .
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
# Production Stage
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package*.json ./
|
||||
COPY prisma ./prisma/
|
||||
RUN npm install --omit=dev
|
||||
|
||||
# Copy build artifacts and necessary files
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/next.config.mjs ./
|
||||
COPY --from=builder /app/next.config.ts ./
|
||||
# Optional: if you have next-pwa and custom worker files
|
||||
# COPY --from=builder /app/public/sw.js ./public/
|
||||
|
||||
# Copy prisma for migrations at runtime
|
||||
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
|
||||
# Script to run migrations and start the app
|
||||
RUN echo '#!/bin/sh\nnpx prisma migrate deploy\nnpm start' > start.sh
|
||||
RUN chmod +x start.sh
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["./start.sh"]
|
||||
Reference in New Issue
Block a user