Files
tvone-api/dockerfile
T

36 lines
923 B
Docker
Raw Normal View History

2026-04-19 23:05:28 +01:00
# Use the official Node.js image as the base image
FROM node:20
2026-04-18 00:33:27 +01:00
WORKDIR /app
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install deps
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
2026-04-19 21:35:33 +01:00
# Copy source
COPY . .
2026-04-18 00:33:27 +01:00
2026-04-19 21:28:59 +01:00
# Ensure env exists (optional safety for containers)
RUN if [ ! -f .env ] && [ -f .env.example ]; then cp .env.example .env; fi
2026-04-19 21:39:51 +01:00
# Required by prisma generate during image build
2026-04-20 15:33:32 +01:00
ARG DATABASE_URL="postgres://tvone:tvone_password@db:5432/tvone"
2026-04-19 21:39:51 +01:00
ENV DATABASE_URL=$DATABASE_URL
2026-04-19 21:28:59 +01:00
2026-04-19 22:29:48 +01:00
# 2. Add the Prisma Schema specifically before generating
# This ensures the generator has the latest schema
COPY prisma ./prisma/
# 3. Generate Prisma Client
# We use 'pnpm exec' to ensure we use the local version synced with your node_modules
RUN pnpm exec prisma generate
2026-04-19 20:18:09 +01:00
2026-04-18 00:33:27 +01:00
# Build NestJS
RUN pnpm build
EXPOSE 3000
2026-04-19 21:35:33 +01:00
# Change your CMD to this:
2026-04-19 20:39:48 +01:00
CMD ["node", "dist/src/main.js"]