content: FROM node:18-alpine
  ARG APP_DIR=/app
  
  WORKDIR ${APP_DIR}
  
  # Install dependencies based on the preferred package manager
  COPY frontend/. .
  RUN mkdir -p ./app
  
  RUN \
    if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
    elif [ -f package-lock.json ]; then npm ci; \
    elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \
    # Allow install without lockfile, so example works even without Node.js installed locally
    else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
    fi
  
  #COPY frontend/app frontend/components frontend/config frontend/lib frontend/styles frontend/types .
  #COPY frontend/public public
  #COPY frontend/next.config.mjs .
  #COPY frontend/tsconfig.json .
  
  # Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
  # Uncomment the following line to disable telemetry at run time
  # ENV NEXT_TELEMETRY_DISABLED 1
  
  # Note: Don't expose ports here, Compose will handle that for us
  
  # Start Next.js in development mode based on the preferred package manager
  CMD \
    if [ -f yarn.lock ]; then yarn dev; \
    elif [ -f package-lock.json ]; then npm run dev; \
    elif [ -f pnpm-lock.yaml ]; then pnpm dev; \
    else npm run dev; \
    fi
  