# E2E Testing Dockerfile for Service Registry Frontend
# Uses Microsoft's Playwright base image for browser testing

FROM mcr.microsoft.com/playwright:v1.57.0-noble

WORKDIR /app

# Copy package files and npm registry config
COPY package.json .npmrc ./

# Install dependencies using npm (simpler for standalone Docker builds)
RUN npm install

# Copy source code
COPY . .

# Build the application
RUN npm run build

# Set environment for CI
ENV CI=true
ENV BASE_URL=http://localhost:4173

# Run preview server + E2E tests
CMD ["sh", "-c", "npm run preview & sleep 3 && npm run test:e2e:local"]
