Files
tvone-api/dockerfile
T

30 lines
686 B
Docker
Raw Normal View History

2026-04-18 00:33:27 +01:00
FROM node:22-alpine
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
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 21:04:40 +01:00
# Generate Prisma Client for the Linux environment
RUN npx 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"]