- Implemented comprehensive integration tests for user management, category management, content publishing, comment system, performance, scalability, and network resilience. - Created DockerNodeManager to manage Docker containers for testing. - Developed ApiClient for API interactions and health checks. - Introduced SyncWaiter for synchronizing node states and ensuring data consistency. - Enhanced test reliability with increased timeouts and detailed logging.
41 lines
819 B
Docker
41 lines
819 B
Docker
# Blog API Node
|
|
FROM node:18-alpine
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache \
|
|
curl \
|
|
python3 \
|
|
make \
|
|
g++ \
|
|
git
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /data
|
|
|
|
# Make the API server executable
|
|
RUN chmod +x tests/real-integration/blog-scenario/docker/blog-api-server.ts
|
|
|
|
# Expose API port
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:3000/health || exit 1
|
|
|
|
# Start the blog API server
|
|
CMD ["node", "dist/tests/real-integration/blog-scenario/docker/blog-api-server.js"] |