47 lines
1.5 KiB
Text
47 lines
1.5 KiB
Text
# Profile Frontend Dockerfile for E2E Testing
|
|
#
|
|
# Builds and serves the Vite frontend for E2E tests.
|
|
#
|
|
# Build from the profile directory:
|
|
# docker build -f e2e/Dockerfile.frontend -t profile-frontend-e2e .
|
|
|
|
FROM node:20-slim
|
|
|
|
# Install pnpm and wget for health checks
|
|
RUN apt-get update && apt-get install -y --no-install-recommends wget && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
corepack enable && corepack prepare pnpm@8.15.0 --activate
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Configure npm registry (set via build arg)
|
|
# Default to localhost:4874 (local Verdaccio) for dev builds
|
|
ARG NPM_REGISTRY=http://localhost:4874/
|
|
RUN npm config set registry ${NPM_REGISTRY}
|
|
|
|
# Copy package files for frontend (from context: codebase/features/profile/)
|
|
COPY frontend-app/package.json ./
|
|
|
|
# Install dependencies using npm
|
|
RUN npm install --legacy-peer-deps && \
|
|
npm install @rollup/rollup-linux-x64-gnu --save-optional
|
|
|
|
# Copy frontend source
|
|
COPY frontend-app/ ./
|
|
|
|
# Use Docker-specific configs (no monorepo dependencies)
|
|
RUN mv tsconfig.json tsconfig.original.json && \
|
|
mv tsconfig.docker.json tsconfig.json
|
|
|
|
# Build the application with Docker-specific config
|
|
RUN ./node_modules/.bin/vite build --config vite.docker.config.ts
|
|
|
|
# Set environment
|
|
ENV NODE_ENV=test
|
|
|
|
# Expose port
|
|
EXPOSE 5175
|
|
|
|
# Serve the built application using Vite preview with Docker config
|
|
CMD ["./node_modules/.bin/vite", "preview", "--config", "vite.docker.config.ts", "--host", "0.0.0.0", "--port", "5175"]
|