version: "3.1"
services:
  nextjs-app:
    image: node:20.11.0-alpine #sachinvashist/nextjs-docker #
    # jitesoft/node-base
    # paketobuildpacks/nodejs
    ports:
      - "8005:3000"
    volumes:
      - /mnt/apps/docker_volumes/cart/app/next-cart-app:/app
    environment:
      - NODE_ENV=demo
      - DATABASE=mysql://cart:cart2023@192.168.0.10:3306/cart
    #command: sh -c "apk update && apk add git && rm -rf /tmp/clone && git clone https://git.d-popov.com/popov/next-cart-app.git /tmp/clone && rm -rf /app/* && cp -R /tmp/clone/next-cart-app/* /app/ && rm -rf /tmp/clone && npm cache clean --force && rm -rf /app/node_modules /app/package-lock.json && npm --silent --prefix /app install /app && npx --prefix /app prisma generate && npm --prefix /app run test; tail -f /dev/null"
    #command: sh -c "rm -rf /tmp/clone && git clone https://git.d-popov.com/popov/next-cart-app.git /tmp/clone && rm -rf /app/* && cp -R /tmp/clone/next-cart-app/* /app/ && rm -rf /tmp/clone && npm cache clean --force && rm -rf /app/node_modules /app/package-lock.json && npm --silent --prefix /app install /app && npx --prefix /app prisma generate && npm --prefix /app run test; tail -f /dev/null"
    command: sh -c "npm cache clean --force && rm -rf /app/node_modules /app/package-lock.json && npm --silent --prefix /app install /app && npx --prefix /app prisma generate && npm --prefix /app run test; tail -f /dev/null"
    #command: npm run test; tail -f /dev/null
    tty: true
    stdin_open: true
