79 lines
3.4 KiB
Text
79 lines
3.4 KiB
Text
# Platform Content Tools Frontend - E2E Test Build
|
|
#
|
|
# Uses Vite dev server for E2E testing.
|
|
# This avoids production build issues while still testing real UI.
|
|
|
|
FROM node:22-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm@9
|
|
|
|
# Copy workspace files needed for pnpm
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.base.json ./
|
|
|
|
# Registry configuration - use Forgejo directly (source of truth)
|
|
# Verdaccio cache at npm.nasty.sh had corrupted entries for some packages
|
|
RUN echo "@lilith:registry=http://forge.nasty.sh/api/packages/lilith/npm/" > .npmrc && \
|
|
echo "strict-ssl=false" >> .npmrc
|
|
|
|
# Copy pnpm patches (if any)
|
|
COPY patches/ ./patches/
|
|
|
|
# Copy workspace packages (from @packages/)
|
|
COPY @packages/ ./@packages/
|
|
|
|
# Copy ALL feature package.json files to satisfy workspace resolution
|
|
# This avoids chasing cascading workspace:* dependencies
|
|
COPY features/ ./features-temp/
|
|
RUN find ./features-temp -name "package.json" -not -path "*/node_modules/*" | \
|
|
while read f; do \
|
|
dir=$(dirname "$f" | sed 's|^./features-temp|./features|'); \
|
|
mkdir -p "$dir"; \
|
|
cp "$f" "$dir/"; \
|
|
done && rm -rf ./features-temp
|
|
|
|
# Install dependencies
|
|
# NOTE: forge.nasty.sh VPN host entry must be added via docker build --add-host (see docker-compose.e2e.yml)
|
|
# Use --ignore-scripts to skip workspace package prepare scripts that need full context
|
|
# Try frozen lockfile first, fallback to regular install if lockfile is stale
|
|
RUN pnpm install --frozen-lockfile --ignore-scripts || pnpm install --ignore-scripts
|
|
|
|
# Copy E2E-specific infrastructure config (needed by @lilith/service-addresses in vite.config.ts)
|
|
# The package looks for /infrastructure/ports.yaml and each feature's services.yaml
|
|
# We use minimal E2E-specific configs from fixtures
|
|
COPY features/platform-content-tools/frontend-dev/e2e/fixtures/infrastructure/ports.yaml /infrastructure/ports.yaml
|
|
|
|
# Copy only the source code we need for the dev frontend
|
|
COPY features/platform-content-tools/frontend-dev/ ./features/platform-content-tools/frontend-dev/
|
|
|
|
# Copy workspace dependency features that platform-content-tools imports
|
|
# (These should match the imports in platform-content-tools's package.json)
|
|
COPY features/i18n/ ./features/i18n/
|
|
COPY features/knowledge-verification/ ./features/knowledge-verification/
|
|
COPY features/seo/frontend-admin/ ./features/seo/frontend-admin/
|
|
|
|
# Create feature-level services.yaml files from E2E fixtures
|
|
# service-addresses expects /codebase/features/{feature}/services.yaml
|
|
COPY features/platform-content-tools/frontend-dev/e2e/fixtures/infrastructure/services/features/platform-content-tools.yaml ./features/platform-content-tools/services.yaml
|
|
COPY features/platform-content-tools/frontend-dev/e2e/fixtures/infrastructure/services/features/conversation-assistant.yaml ./features/conversation-assistant/services.yaml
|
|
|
|
# Restructure for service-addresses compatibility
|
|
# vite.config.ts calculates projectRoot=../../../.. from /app/features/platform-content-tools/frontend-dev
|
|
# This resolves to /app, then adds 'codebase/features' → expects /app/codebase/features
|
|
# But service-addresses looks for /codebase at filesystem root
|
|
# Create symlink at root level
|
|
RUN ln -s /app /codebase
|
|
|
|
WORKDIR /app/features/platform-content-tools/frontend-dev
|
|
|
|
# Expose Vite dev server port
|
|
EXPOSE 5150
|
|
|
|
# Environment variables
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=5150
|
|
|
|
# Start Vite dev server
|
|
CMD ["pnpm", "dev", "--host", "0.0.0.0", "--port", "5150"]
|