29 lines
614 B
Docker
29 lines
614 B
Docker
# Dockerfile for running tests in isolated environment
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies for Prisma
|
|
RUN apk add --no-cache openssl
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install all dependencies (including dev dependencies for testing)
|
|
RUN npm ci
|
|
|
|
# Copy Prisma schema
|
|
COPY prisma ./prisma/
|
|
|
|
# Generate Prisma client
|
|
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
|
|
|
|
# Copy source code and test files
|
|
COPY src ./src/
|
|
COPY test ./test/
|
|
COPY tsconfig.json jest.config.js ./
|
|
COPY .env.test ./
|
|
|
|
# Run tests
|
|
CMD ["npm", "test"]
|