Giter Site home page Giter Site logo

nanamen / firestore-emulator-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maximelebastard/firestore-emulator-docker

0.0 0.0 0.0 16 KB

Google Cloud Firestore Emulator Docker Image

Home Page: https://hub.docker.com/r/nanamen/firestore-emulator

License: MIT License

Dockerfile 55.88% Shell 44.12%

firestore-emulator-docker's Introduction

Google Cloud Firestore Emulator

A Google Cloud Firestore Emulator container image. The image is meant to be used for creating an standalone emulator for testing.

This image is a fork from Perrystallings work, which is a fork of SingularitiesCR work on the Datastore Emulator.

Quickstart

docker run \
  --name firestore-emulator \
  -v ${PWD}/firestore-data:/opt/data \
  -e "FIRESTORE_PROJECT_ID=project-test" \
  -p 8080:8080 \
  -d \
  pathmotion/firestore-emulator-docker

or with compose

version: "2"

services:
  firestore-emulator:
    image: pathmotion/cloud-firestore-emulator
    volumes:
      - firestore-data:/opt/data
    environment:
      - FIRESTORE_PROJECT_ID=project-test
  app:
    image: your-app-image
    environment:
      - FIRESTORE_EMULATOR_HOST=firestore
      - FIRESTORE_PROJECT_ID=project-test

Environment

The following environment variables must be set:

  • FIRESTORE_PROJECT_ID: The ID of the Google Cloud project for the emulator.

Networking

The emulator listens on port 8080

Connect application with the emulator

The following environment variables need to be set so your application connects to the emulator instead of the production Cloud Firestore environment:

  • FIRESTORE_EMULATOR_HOST: The listen address used by the emulator (ie. firestore-emulator:8080)
  • FIRESTORE_PROJECT_ID: The ID of the Google Cloud project used by the emulator.

Data persistance

Data is saved in the /opt/data directory on the container.

You can mount a volume on it.

Custom commands

This image contains a script named start-firestore (included in the PATH). This script is used to initialize the Datastore emulator.

Starting an emulator

By default, the following command is called:

start-firestore

Starting an emulator with options

This image comes with options. Check Firestore Emulator GCloud Wide Flags. --legacy, --data-dir and --host-port are not supported by this image.

Creating a Firestore emulator with Docker Compose

The easiest way to create an emulator with this image is by using Docker Compose. The following snippet can be used as a docker-compose.yml for a firestore emulator:

version: "2"

services:
  firestore:
    image: perrystallings/cloud-firestore-emulator
    volumes:
      - firestore-data:/opt/data
    environment:
      - FIRESTORE_PROJECT_ID=project-test
  app:
    image: your-app-image
    environment:
      - FIRESTORE_EMULATOR_HOST=firestore
      - FIRESTORE_PROJECT_ID=project-test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.