# ─── Testver Dashboard — Production Container ────────────────────────────────
#
# Installs Testver from npm (no source code needed)
#
# Usage:
#   docker build -t testver/dashboard -f deploy/Dockerfile .
#   docker run -d -p 3700:3700 -v /path/to/test-project:/project testver/dashboard
#
# Or via: testver deploy docker

FROM node:22-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl git && rm -rf /var/lib/apt/lists/*

# Install Testver globally from npm
RUN npm install -g testver

# Install Playwright browsers for automation
RUN npx playwright install --with-deps chromium 2>/dev/null || true

# Create project mount point
RUN mkdir -p /project
WORKDIR /project

# Expose port
EXPOSE 3700

# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
    CMD curl -f http://localhost:3700/api/health || exit 1

# Environment
ENV TESTVER_HOST=0.0.0.0
ENV TESTVER_PORT=3700
ENV NODE_ENV=production

# Start Testver in serve mode
CMD ["testver", "serve", "--host", "0.0.0.0", "--port", "3700"]
