Spaces:
Build error
Build error
FROM node:18-alpine AS build | |
# Install git | |
RUN apk add --no-cache git | |
WORKDIR /app | |
# Clone the repository | |
RUN git clone https://github.com/al1abb/invoify . | |
# Install only production dependencies to reduce memory usage | |
RUN npm install --only=production --no-fund --no-audit | |
# Install dev dependencies separately with NODE_OPTIONS to limit memory | |
RUN NODE_OPTIONS=--max_old_space_size=512 npm install --only=dev --no-fund --no-audit | |
# Build with memory limits | |
RUN NODE_OPTIONS=--max_old_space_size=512 npm run build | |
FROM node:18-alpine AS production | |
RUN addgroup --system --gid 1001 nodejs | |
RUN adduser --system --uid 1001 nextjs | |
WORKDIR /app | |
# Copy only what's needed for production | |
COPY --from=build --chown=nextjs:nodejs /app/.next ./.next | |
COPY --from=build --chown=nextjs:nodejs /app/node_modules ./node_modules | |
COPY --from=build --chown=nextjs:nodejs /app/package.json ./package.json | |
COPY --from=build --chown=nextjs:nodejs /app/public ./public | |
USER nextjs | |
ENV NODE_ENV production | |
ENV PORT 3000 | |
EXPOSE 3000 | |
# Use the start command from package.json | |
CMD ["npm", "start"] |