Project provides Docker container to run Firebase Emulator locally.
docker build -t firebase-emulator .
If you have existing firebase project, you may want to import rules & dataset first.
To do so, you need to have firebase tool to be installed.
First, create some new directory to host your Firebase data and cd
into it.
Then, init project by using your existing remote Firebase project:
firebase list
firebase --project <project-id> init database
After this step you should have two files in your directory:
firebase.json
database.rules.json
NOTE: if you do not care about actual rules, you can just create empty
firebase.json
by yourself:
echo '{}' > firebase.json
Then, you need to export your dataset:
firebase --project <project-id> database:get / > database.json
You need to run this command from same directory as in previous step:
docker run -d -v `pwd`:/firebase -p 443:443 firebase-emulator
After container was started, nginx.crt
file should appear in your Firebase
directory.
In order to access Firebase container by HTTPS, you need to add generated certificate into your local trust store:
sudo trust anchor nginx.crt
sudo tee -a /etc/hosts <<< '127.0.0.1 local.firebaseio.com'
curl -s https://local.firebaseio.com/.json