platform-codebase/features/seo/e2e/Dockerfile.frontend

42 lines
1 KiB
Text
Executable file

# SEO Frontend Public Dockerfile for E2E Testing
#
# Builds and serves the Vite frontend for E2E tests.
#
# Build from the seo directory:
# docker build -f e2e/Dockerfile.frontend -t seo-frontend-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 frontend (from context: codebase/features/seo/)
COPY frontend-public/package.json ./
COPY frontend-public/pnpm-lock.yaml* ./
# Install dependencies
RUN pnpm install --frozen-lockfile || pnpm install
# Copy frontend source
COPY frontend-public/ ./
# Build the application
RUN pnpm build
# Set environment
ENV NODE_ENV=test
# Expose port
EXPOSE 4003
# Serve the built application using Vite preview
CMD ["pnpm", "preview", "--host", "0.0.0.0", "--port", "4003"]