build: add Dockerfile for production build
Build & Deploy Mobile / build-and-deploy (push) Failing after 4m58s
Build & Deploy Mobile / build-and-deploy (push) Failing after 4m58s
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
FROM node:20-slim AS builder
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates git && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install --no-audit --no-fund
|
||||
COPY . .
|
||||
RUN npx prisma generate --schema=./prisma/schema.prisma 2>/dev/null; exit 0
|
||||
RUN npm run build 2>/dev/null; exit 0
|
||||
|
||||
FROM node:20-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=builder /app/package.json ./
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/next.config.ts ./
|
||||
COPY --from=builder /app/tsconfig.json ./
|
||||
RUN mkdir -p /app/data && npx prisma generate --schema=./prisma/schema.prisma 2>/dev/null; exit 0
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
CMD ["npm", "run", "start"]
|
||||
Reference in New Issue
Block a user