version: "3.1"
services:
  nextjs-app:
    image: docker.d-popov.com/jwpw:latest
    ports:
      - "5001:3000"
    environment:
      - NODE_ENV=prod
      - DATABASE=mysql://cart:o74x642Rc8@mariadb:3306/cart
      - UPDATE_CODE_FROM_GIT=true # Set to true to pull latest code from Git
      - GIT_USERNAME=deploy
      - GIT_PASSWORD=%L3Kr2R438u4F7^%40
    command: sh -c " cd /app && npm install && npm run nodeenv; tail -f /dev/null"
    tty: true
    stdin_open: true
  mariadb:
    hostname: mariadb
    image: mariadb #bitnami/mariadb:latest #mariadb:10.4
    environment:
      MARIADB_ROOT_PASSWORD: Pw62L$3332JH
      MYSQL_ROOT_PASSWORD: Pw62L$3332JH
      MYSQL_DATABASE: cart
      MYSQL_USER: cart
      MYSQL_PASSWORD: o74x642Rc8
    networks:
      - default
      - mysql_default
  postgres:
    deploy:
      replicas: 0
    hostname: postgres
    image: postgres
    restart: always
    # set shared memory limit when using docker-compose
    shm_size: 128mb
    # or set shared memory limit when deploy via swarm stack
    #volumes:
    #  - type: tmpfs
    #    target: /dev/shm
    #    tmpfs:
    #      size: 134217728 # 128*2^20 bytes = 128Mb
    environment:
      POSTGRES_PASSWORD: i4966cWBtP3xJ7BLsbsgo93C8Q5262
