FROM node:14-bullseye

# Install additional tools including Ionic CLI and build dependencies for older projects
RUN apt-get update && apt-get install -y \
    git \
    curl \
    vim \
    python2.7 \
    python2.7-dev \
    build-essential \
    && ln -sf /usr/bin/python2.7 /usr/bin/python \
    && ln -sf /usr/bin/python2.7 /usr/bin/python2 \
    && rm -rf /var/lib/apt/lists/*

# Install MongoDB shell via npm (works on all architectures)
# Note: mongosh requires Node 18+, but we're using Node 14 for legacy compatibility
# We'll use the mongo command from the mongo container instead

# Install global npm packages for development
RUN npm install -g \
    @ionic/cli \
    @angular/cli \
    nodemon \
    concurrently \
    eslint \
    prettier

# Set working directory
WORKDIR /workspaces/PfosiLooking-monorepo

# Copy package files for dependency caching
COPY package*.json ./
COPY app/package*.json ./app/
COPY backend/package*.json ./backend/

# Install dependencies separately to avoid node-sass issues during build
# We'll install them after container starts
# RUN npm install
# RUN cd app && npm install  
# RUN cd backend && npm install

# Keep container running
CMD ["sleep", "infinity"]