platform-codebase/features/status-dashboard/e2e/Dockerfile.api
2026-01-18 09:21:31 -08:00

47 lines
1.2 KiB
Text
Executable file

# Status Dashboard Backend API Dockerfile for E2E Testing
#
# Builds and runs the NestJS backend API with SQLite for E2E tests.
#
# Build from the status-dashboard directory:
# docker build -f e2e/Dockerfile.api -t status-dashboard-api-e2e .
FROM node:20-alpine
# Install pnpm and wget for health checks
RUN apk add --no-cache wget python3 make g++ && \
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/status-dashboard/)
COPY backend-api/package.json ./
COPY backend-api/pnpm-lock.yaml* ./
# Install dependencies (better-sqlite3 needs native compilation)
RUN pnpm install --frozen-lockfile || pnpm install
# Copy backend source
COPY backend-api/ ./
# Build the application
RUN pnpm build
# Create data directory for SQLite
RUN mkdir -p /app/data
# Set environment
ENV NODE_ENV=test
ENV PORT=5000
ENV DATABASE_PATH=/app/data/status-dashboard.db
# Expose port
EXPOSE 5000
# Run the API
CMD ["node", "dist/main.js"]