FROM node:20-slim # Install dependencies for canvas and development tools RUN apt-get update && apt-get install -y --no-install-recommends \ python3 \ python-is-python3 \ make \ g++ \ build-essential \ libcairo2-dev \ libpango1.0-dev \ libjpeg-dev \ libgif-dev \ librsvg2-dev \ procps \ curl \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy package files for dependency installation COPY package*.json ./ COPY frontend/package*.json ./frontend/ # Install backend dependencies and global development tools RUN npm install RUN npm install -g ts-node-dev ts-node # Install frontend dependencies WORKDIR /app/frontend RUN npm install # Return to app directory WORKDIR /app # Copy configuration files (not source code, which will be mounted as volumes) COPY tsconfig*.json ./ # Create logs directory RUN mkdir -p /app/logs # Set environment variable to indicate we're in a Docker container ENV DOCKER_CONTAINER=true ENV MOCK_SERVER_HOST=0.0.0.0 ENV DRY_RUN=false # Expose ports for backend, frontend, and mock server EXPOSE 7654 7655 # Create a startup script that checks for dry run RUN echo '#!/bin/sh\n\ if [ "$DRY_RUN" = "true" ]; then\n\ echo "================================================="\n\ echo "Dry run mode enabled - not starting development server"\n\ echo "================================================="\n\ echo "Would have run: ./scripts/start-dev.sh"\n\ echo "Environment: NODE_ENV=$NODE_ENV, USE_MOCK_DATA=$USE_MOCK_DATA"\n\ echo "================================================="\n\ exit 0\n\ else\n\ ./scripts/start-dev.sh\n\ fi' > /app/docker-entrypoint.sh && \ chmod +x /app/docker-entrypoint.sh # Use the startup script as the entry point CMD ["/app/docker-entrypoint.sh"]