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

42 lines
1.1 KiB
Text
Executable file

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