Files
tvone-api/dockerfile
T

39 lines
1.0 KiB
Docker
Raw Normal View History

2026-04-18 00:33:27 +01:00
FROM node:22-alpine
WORKDIR /app
2026-04-19 22:56:59 +01:00
# 1. Install system dependencies
# Added 'libcrypto3' and 'libssl3' which Prisma often needs on newer Alpine
RUN apk add --no-cache openssl libc6-compat libcrypto3 libssl3
2026-04-19 22:37:31 +01:00
2026-04-18 00:33:27 +01:00
# 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
ARG DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
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"]