From 401526a0ce3ed0d84a3aa00fa28f4dcaeca2a2f9 Mon Sep 17 00:00:00 2001 From: Bear Su Date: Thu, 2 Nov 2023 18:13:46 +0800 Subject: [PATCH] first commit --- Dockerfile | 20 ++++++++++++++++++++ README.md | 16 ++++++++++++++++ entrypoint.sh | 10 ++++++++++ firebase.json | 14 ++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 Dockerfile create mode 100755 entrypoint.sh create mode 100644 firebase.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..432f79d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:21-slim + +ENV FIREBASE_TOOLS_VERSION=12.8.0 +WORKDIR /firebase + +RUN yarn global add firebase-tools@${FIREBASE_TOOLS_VERSION} && \ + yarn cache clean && \ + firebase -V + +RUN apt update && apt install -y curl && rm -rf /var/cache/apk/* + +RUN firebase setup:emulators:ui + +COPY --link firebase.json /firebase/firebase.json +COPY --link entrypoint.sh /firebase/entrypoint.sh + +EXPOSE 4000 +EXPOSE 9099 + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/README.md b/README.md index f7b5b4e..5567c74 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # firebase-auth-emulator + Firebase Auth Emulator Container Image + +Reference: https://github.com/seletskiy/firebase-emulator/tree/master + +## Usage + +```bash +docker run -it --rm \ + -p 4000:4000 \ + -p 9099:9099 \ + ghcr.io/timfanda35/firebase-auth-emulator +``` + +- Emulator UI: http://127.0.0.1:4000 +- Firebase Auth API Prefix: `http://127.0.0.1:9099/identitytoolkit.googleapis.com/v1` +- project id: `firebase-auth-emulator` diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..6cd6893 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euo pipefail + +data_dir=emulators.data +firebase_project_id=firebase-auth-emulator + +exec firebase emulators:start 2>&1 \ + $([ -d $data_dir ] && echo "--import $data_dir") \ + --project "$firebase_project_id" diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..79453b1 --- /dev/null +++ b/firebase.json @@ -0,0 +1,14 @@ +{ + "emulators": { + "auth": { + "enabled": true, + "host": "0.0.0.0", + "port": 9099 + }, + "ui": { + "enabled": true, + "host": "0.0.0.0", + "port": 4000 + } + } +} \ No newline at end of file