Skip to content

radicalbit/docker-firestore-emulator-with-ui

 
 

Repository files navigation

Intro

Fork of https://github.com/matthewkrupnik/docker-firestore-emulator-with-ui to expose the ports of the emulator through environment variables

Container is running Alpine linux with Node LTS, Bash, and Openjdk11 installed. Container installs the firebase-toolkit from npm. It also installs the firestore, pubsub, andfunctions emulator and turns on the UI.

Execute container

docker run -p 8080:8080 -p 4000:4000 -p 8085:8085 -p 5001:5001 tools.radicalbit.io/docker-firestore-emulator-with-ui:latest

Execute the container exposing the firestore server on the port 8200 instead of the standard 8080 docker run -e FIRESTORE_PORT=8200 -p 8200:8200 -p 4000:4000 -p 8085:8085 -p 5001:5001 tools.radicalbit.io/docker-firestore-emulator-with-ui:latest

Env variables and ports

  • FIRESTORE_PORT default to 8080
  • UI_PORT default to 4000
  • PUSUB_PORT default to 8085
  • FUNCTIONS_PORT default to 5001

Mountpoints

  • firestore.indexes.json is found at /firebase/firestore.indexes.json
  • firestore.rules is found at /firebase.rules
  • functions need to be loaded at /firestore/functions

Firestore

To use firestore emulator

  • the environment variable needs to be set FIRESTORE_EMULATOR_HOST="localhost:8080"

OR

  • The firestore options should be correctly configured
FirebaseOptions
  .builder()
  .setCredentials(GoogleCredentials.newBuilder().build())
  //Enable usage of firestore emulator
  .setFirestoreOptions(FirestoreOptions.newBuilder().setEmulatorHost(url).build())
  .setDatabaseUrl(url)
  .setProjectId("dummy-project") //Use this project-id, do not change it
  .build()

PubSub

PUBSUB_EMULATOR_HOST="localhost:8085"

Functions

You functions folder needs to be volume mounted to /firestore/functions. The following npm packages are required:

  • "firebase-admin": "^8.10.0",
  • "firebase-functions": "^3.6.1"

The container will run an npm install on the functions repository and the settings are as follows:

"functions": {
"predeploy": [
"npm --prefix ./functions run lint",
"npm --prefix ./functions run build"
],
"source": "functions"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 78.8%
  • Dockerfile 11.1%
  • Shell 10.1%