platform-codebase/features/platform-admin/backend-api/Dockerfile.e2e

55 lines
1.7 KiB
Text
Executable file

# Platform Admin API Dockerfile for E2E Testing
#
# Uses workspace root context for proper pnpm workspace resolution.
# Run from codebase/ with: dockerfile: features/platform-admin/backend-api/Dockerfile.e2e
FROM node:22-alpine
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm@9
# Registry configuration (from docker-compose build args)
ARG NPM_REGISTRY=http://npm.nasty.sh/
RUN echo "@lilith:registry=${NPM_REGISTRY}" > .npmrc && \
echo "strict-ssl=false" >> .npmrc
# Copy workspace files needed for pnpm
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Copy the feature package.json for dependency resolution
COPY features/platform-admin/backend-api/package.json ./features/platform-admin/backend-api/
# Copy shared packages that this service depends on
COPY @packages/ ./@packages/
# Install dependencies
# NOTE: forge.nasty.sh VPN host entry must be added via docker build --add-host
# Use --ignore-scripts to skip workspace package prepare scripts that need full context
RUN pnpm install --frozen-lockfile --ignore-scripts || pnpm install --ignore-scripts
# Copy E2E infrastructure config (required by @lilith/service-addresses)
COPY features/platform-admin/frontend-admin/e2e/fixtures/infrastructure/ /infrastructure/
# Copy source code
COPY features/platform-admin/backend-api/ ./features/platform-admin/backend-api/
WORKDIR /app/features/platform-admin/backend-api
# Build the application
RUN pnpm build
# Expose port
EXPOSE 3011
# Environment defaults
ENV PORT=3011
ENV NODE_ENV=test
# Health check
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3011/health || exit 1
# Start the server
CMD ["node", "dist/main.js"]