Files
Papo/dockerfile
Pascal Prießnitz 3053dcad6a
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 2m14s
[deploy] Allow npm install fallback in Docker build
2025-12-04 16:57:39 +01:00

35 lines
1.0 KiB
Plaintext

FROM node:20-bookworm
WORKDIR /usr/src/app
# Install only needed build deps, then clean up
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
ENV NODE_ENV=development
ENV NPM_CONFIG_PRODUCTION=false
ENV PATH="/usr/src/app/node_modules/.bin:${PATH}"
# dummy DB URL for prisma generate at build time
ENV DATABASE_URL=postgresql://user:pass@localhost:5432/papo?schema=public
ENV PRISMA_IGNORE_ENV_LOAD=true
# Install dependencies (inkl. dev)
COPY package.json package-lock.json ./
# fail fast if lockfile missing in build context
RUN test -f package-lock.json
# npm ci fails in some pipelines despite lockfile; fall back to npm install if needed
RUN npm ci --include=dev || npm install --include=dev
# Ensure prisma CLI available globally (avoids path issues)
RUN npm install -g prisma@5.4.2
# Copy source
COPY . .
# Generate Prisma client (explicit schema path)
RUN prisma generate --schema=src/database/schema.prisma
# Optional: show versions in build log
RUN node -v && npm -v && npx prisma -v
CMD ["npm", "run", "dev"]