`docker-compose up -d` is super slow (takes more than 20 minutes)

I’m using Mac OS Mojave 10.14.6, its docker-compose version is 1.25.4, build 8d51620a.

I want to deploy code to a server, whose docker version is Docker Engine - Community 19.03.8.

The problem is that docker-compose up -d takes long time (more than 20 minutes) in Building funfun-node. Here is a run with verbose: https://textbin.net/hyJHfnP2VS . It almost hangs at paramiko.transport._log: [chan 11] Sesch channel 11 request ok.

Does anyone know what may be the problem?

Here is Dockerfile:

FROM node:12
RUN npm install -g nrm && nrm use cnpm
COPY ./package.json /opt/funfun/package.json
WORKDIR /opt/funfun
RUN yarn
COPY ./ /opt/funfun/
CMD yarn start

Here is docker-compose.yml:

version: "3"
services:
  funfun-node:
    image: funfun
    restart: always
    build: .
    environment:
    - MONGODB_URI=mongodb://mongodb:27017/news
    env_file:
    - ./.env
    depends_on:
    - mongodb
    ports:
    - "3000:3000"
  funfun-nginx:
    image: funfun-nginx
    restart: always
    build:
      context: .
      dockerfile: Dockerfile.nginx
      
    ports:
    - "80:8081"
    - "443:8443"
    depends_on:
    - funfun-node
  mongodb:
    image: mongo:3.4
    restart: always
    volumes:
    - "10studio-mongo:/data/db"
    ports:
    - "27018:27017"
networks:
  default:
    external:
      name: 10studio
volumes:
  10studio-mongo:
    driver: local 

Edit 1: I also tried to append 127.0.0.1 localunixsocket and 127.0.0.1 localunixsocket.local to /etc/hosts on my Mac, but it did not help.

Here is my current /etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.30.255.113  github.com
127.0.0.1       AcronisDriveSearchPlugin

# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
10.211.55.3     windows-8.1.shared windows-8.1 #prl_hostonly shared

127.0.0.1 localunixsocket
127.0.0.1 localunixsocket.local