Not sure that’s the official way, @nmattia or @frederikrothenberger can probably simplies the commands but, I do it as following in my projects when I want to deploy II locally:
git clone https://github.com/dfinity/internet-identity
cd internet-identity/demos/using-dev-build
npm ci
dfx deploy --no-wallet --argument '(null)'