platform-codebase/features/landing/e2e/Dockerfile.api

43 lines
1 KiB
Text
Executable file

# Landing Backend API Dockerfile for E2E Testing
#
# Builds and runs the NestJS backend API for E2E tests.
#
# Build from the landing directory:
# docker build -f e2e/Dockerfile.api -t landing-api-e2e .
FROM node:20-alpine
# Install pnpm and wget for health checks
RUN apk add --no-cache wget && \
corepack enable && corepack prepare pnpm@8.15.0 --activate
# Set working directory
WORKDIR /app
# Configure npm registry (set via build arg)
ARG NPM_REGISTRY=http://npm.nasty.sh/
RUN npm config set registry ${NPM_REGISTRY} && \
pnpm config set registry ${NPM_REGISTRY}
# Copy package files for backend (from context: codebase/features/landing/)
COPY backend-api/package.json ./
COPY backend-api/pnpm-lock.yaml* ./
# Install dependencies
RUN pnpm install --frozen-lockfile || pnpm install
# Copy backend source
COPY backend-api/ ./
# Build the application
RUN pnpm build
# Set environment
ENV NODE_ENV=test
ENV PORT=3010
# Expose port
EXPOSE 3010
# Run the API (adjust path based on NestJS build output)
CMD ["node", "dist/main.js"]