Dagger
Search

gcp-firebase

This module provides utilities for:
- Firebase Hosting: Build and deploy web applications, preview channels
- Firestore: Create, update, delete, and manage Firestore databases
- Scripts: Run scripts with Firebase/Firestore credentials in any language

Installation

dagger install github.com/telchak/daggerverse/gcp-firebase@v0.1.0

Entrypoint

Return Type
GcpFirebase !
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
func (m *MyModule) Example() *dagger.GcpFirebase  {
	return dag.
			GcpFirebase()
}
@function
def example() -> dagger.GcpFirebase:
	return (
		dag.gcp_firebase()
	)
@func()
example(): GcpFirebase {
	return dag
		.gcpFirebase()
}

Types

GcpFirebaseFirestore 🔗

Firestore database management utilities using gcloud CLI.

create() 🔗

Create a new Firestore database.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
databaseIdString !-Database ID (4-63 chars, lowercase, hyphens)
locationString !-Database location (e.g., us-central1, nam5)
databaseTypeString !"firestore-native"Type: firestore-native or datastore-mode
deleteProtectionBoolean !falseEnable delete protection
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 create --gcloud IMAGE:TAG --database-id string --location string --database-type string --delete-protection boolean
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container, databaseId string, location string, databaseType string, deleteProtection bool) string  {
	return dag.
			GcpFirebase().
			Firestore().
			Create(ctx, gcloud, databaseId, location, databaseType, deleteProtection)
}
@function
async def example(gcloud: dagger.Container, database_id: str, location: str, database_type: str, delete_protection: bool) -> str:
	return await (
		dag.gcp_firebase()
		.firestore()
		.create(gcloud, database_id, location, database_type, delete_protection)
	)
@func()
async example(gcloud: Container, databaseId: string, location: string, databaseType: string, deleteProtection: boolean): Promise<string> {
	return dag
		.gcpFirebase()
		.firestore()
		.create(gcloud, databaseId, location, databaseType, deleteProtection)
}

delete() 🔗

Delete a Firestore database.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
databaseIdString !-Database ID to delete
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 delete --gcloud IMAGE:TAG --database-id string
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container, databaseId string) string  {
	return dag.
			GcpFirebase().
			Firestore().
			Delete(ctx, gcloud, databaseId)
}
@function
async def example(gcloud: dagger.Container, database_id: str) -> str:
	return await (
		dag.gcp_firebase()
		.firestore()
		.delete(gcloud, database_id)
	)
@func()
async example(gcloud: Container, databaseId: string): Promise<string> {
	return dag
		.gcpFirebase()
		.firestore()
		.delete(gcloud, databaseId)
}

describe() 🔗

Get details of a Firestore database.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
databaseIdString !-Database ID to describe
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 describe --gcloud IMAGE:TAG --database-id string
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container, databaseId string) string  {
	return dag.
			GcpFirebase().
			Firestore().
			Describe(ctx, gcloud, databaseId)
}
@function
async def example(gcloud: dagger.Container, database_id: str) -> str:
	return await (
		dag.gcp_firebase()
		.firestore()
		.describe(gcloud, database_id)
	)
@func()
async example(gcloud: Container, databaseId: string): Promise<string> {
	return dag
		.gcpFirebase()
		.firestore()
		.describe(gcloud, databaseId)
}

exists() 🔗

Check if a Firestore database exists.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
databaseIdString !-Database ID to check
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 exists --gcloud IMAGE:TAG --database-id string
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container, databaseId string) bool  {
	return dag.
			GcpFirebase().
			Firestore().
			Exists(ctx, gcloud, databaseId)
}
@function
async def example(gcloud: dagger.Container, database_id: str) -> bool:
	return await (
		dag.gcp_firebase()
		.firestore()
		.exists(gcloud, database_id)
	)
@func()
async example(gcloud: Container, databaseId: string): Promise<boolean> {
	return dag
		.gcpFirebase()
		.firestore()
		.exists(gcloud, databaseId)
}

list() 🔗

List all Firestore databases in the project.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 list --gcloud IMAGE:TAG
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container) string  {
	return dag.
			GcpFirebase().
			Firestore().
			List(ctx, gcloud)
}
@function
async def example(gcloud: dagger.Container) -> str:
	return await (
		dag.gcp_firebase()
		.firestore()
		.list(gcloud)
	)
@func()
async example(gcloud: Container): Promise<string> {
	return dag
		.gcpFirebase()
		.firestore()
		.list(gcloud)
}

update() 🔗

Update a Firestore database configuration.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gcloudContainer !-Authenticated gcloud container
databaseIdString !-Database ID to update
deleteProtectionBoolean !-Enable or disable delete protection
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore \
 update --gcloud IMAGE:TAG --database-id string --delete-protection boolean
func (m *MyModule) Example(ctx context.Context, gcloud *dagger.Container, databaseId string, deleteProtection bool) string  {
	return dag.
			GcpFirebase().
			Firestore().
			Update(ctx, gcloud, databaseId, deleteProtection)
}
@function
async def example(gcloud: dagger.Container, database_id: str, delete_protection: bool) -> str:
	return await (
		dag.gcp_firebase()
		.firestore()
		.update(gcloud, database_id, delete_protection)
	)
@func()
async example(gcloud: Container, databaseId: string, deleteProtection: boolean): Promise<string> {
	return dag
		.gcpFirebase()
		.firestore()
		.update(gcloud, databaseId, deleteProtection)
}

GcpFirebaseFirebaseScripts 🔗

Run scripts with Firebase/Firestore credentials. Provides language-specific runners for common use cases (Node.js, Python) and a generic container method for other languages (Go, Java, Ruby, etc.). All methods configure GCP Application Default Credentials (ADC), which works with: - Firebase Admin SDK - Google Cloud Firestore SDK - Any GCP client library that supports ADC

container() 🔗

Get a container with Firebase credentials configured for any language.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Source directory
baseImageString !-Base container image
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token
projectIdString nullGCP project ID
workingDirString !"."Working directory relative to source root
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 scripts \
 container --base-image string --working-dir string
func (m *MyModule) Example(baseImage string, workingDir string) *dagger.Container  {
	return dag.
			GcpFirebase().
			Scripts().
			Container(baseImage, workingDir)
}
@function
def example(base_image: str, working_dir: str) -> dagger.Container:
	return (
		dag.gcp_firebase()
		.scripts()
		.container(base_image, working_dir)
	)
@func()
example(baseImage: string, workingDir: string): Container {
	return dag
		.gcpFirebase()
		.scripts()
		.container(baseImage, workingDir)
}

node() 🔗

Run a Node.js or TypeScript script with Firebase credentials.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Source directory
scriptString !-Script path relative to working_dir
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token
projectIdString nullGCP project ID
workingDirString !"."Working directory relative to source root
nodeVersionString !"20"Node.js version
installCommandString !"npm ci"Package install command
env[String ! ] nullEnvironment variables (KEY=VALUE format)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 scripts \
 node --script string --working-dir string --node-version string --install-command string
func (m *MyModule) Example(ctx context.Context, script string, workingDir string, nodeVersion string, installCommand string) string  {
	return dag.
			GcpFirebase().
			Scripts().
			Node(ctxscript, workingDir, nodeVersion, installCommand)
}
@function
async def example(script: str, working_dir: str, node_version: str, install_command: str) -> str:
	return await (
		dag.gcp_firebase()
		.scripts()
		.node(script, working_dir, node_version, install_command)
	)
@func()
async example(script: string, workingDir: string, nodeVersion: string, installCommand: string): Promise<string> {
	return dag
		.gcpFirebase()
		.scripts()
		.node(script, workingDir, nodeVersion, installCommand)
}

python() 🔗

Run a Python script with Firebase credentials.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Source directory
scriptString !-Script path relative to working_dir
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token
projectIdString nullGCP project ID
workingDirString !"."Working directory relative to source root
pythonVersionString !"3.12"Python version
installCommandString nullPackage install command
env[String ! ] nullEnvironment variables (KEY=VALUE format)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 scripts \
 python --script string --working-dir string --python-version string
func (m *MyModule) Example(ctx context.Context, script string, workingDir string, pythonVersion string) string  {
	return dag.
			GcpFirebase().
			Scripts().
			Python(ctxscript, workingDir, pythonVersion)
}
@function
async def example(script: str, working_dir: str, python_version: str) -> str:
	return await (
		dag.gcp_firebase()
		.scripts()
		.python(script, working_dir, python_version)
	)
@func()
async example(script: string, workingDir: string, pythonVersion: string): Promise<string> {
	return dag
		.gcpFirebase()
		.scripts()
		.python(script, workingDir, pythonVersion)
}

GcpFirebase 🔗

Firebase Hosting deployment utilities for Dagger pipelines.

build() 🔗

Build the web application and return the dist directory.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Source directory
buildCommandString !"npm run build"Build command (empty string to skip build)
nodeVersionString !"20"Node.js version
npmCacheCacheVolume nullCustom npm cache volume (uses default if not provided)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 build --build-command string --node-version string
func (m *MyModule) Example(buildCommand string, nodeVersion string) *dagger.Directory  {
	return dag.
			GcpFirebase().
			Build(buildCommand, nodeVersion)
}
@function
def example(build_command: str, node_version: str) -> dagger.Directory:
	return (
		dag.gcp_firebase()
		.build(build_command, node_version)
	)
@func()
example(buildCommand: string, nodeVersion: string): Directory {
	return dag
		.gcpFirebase()
		.build(buildCommand, nodeVersion)
}

deleteChannel() 🔗

Delete a Firebase Hosting preview channel.

Supports three authentication methods: 1. OIDC/WIF (recommended): Provide oidc_token + workload_identity_provider 2. Service account: Provide credentials (JSON key) 3. Access token (deprecated): Provide access_token

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectIdString !-Firebase project ID
channelIdString !-Preview channel ID to delete
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token (deprecated, use OIDC or credentials)
siteString nullFirebase site (defaults to project ID)
nodeVersionString !"20"Node.js version
npmCacheCacheVolume nullCustom npm cache volume (uses default if not provided)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 delete-channel --project-id string --channel-id string --node-version string
func (m *MyModule) Example(ctx context.Context, projectId string, channelId string, nodeVersion string) string  {
	return dag.
			GcpFirebase().
			DeleteChannel(ctx, projectId, channelId, nodeVersion)
}
@function
async def example(project_id: str, channel_id: str, node_version: str) -> str:
	return await (
		dag.gcp_firebase()
		.delete_channel(project_id, channel_id, node_version)
	)
@func()
async example(projectId: string, channelId: string, nodeVersion: string): Promise<string> {
	return dag
		.gcpFirebase()
		.deleteChannel(projectId, channelId, nodeVersion)
}

deploy() 🔗

Build and deploy to Firebase Hosting.

Supports three authentication methods: 1. OIDC/WIF (recommended): Provide oidc_token + workload_identity_provider 2. Service account: Provide credentials (JSON key) 3. Access token (deprecated): Provide access_token

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectIdString !-Firebase project ID
sourceDirectory -Source directory
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token (deprecated, use OIDC or credentials)
buildCommandString !"npm run build"Build command (empty string to skip build)
nodeVersionString !"20"Node.js version
skipBuildBoolean !falseSkip npm ci and build step (use when source is pre-built)
deployFunctionsBoolean !trueDeploy Cloud Functions
forceBoolean !trueForce deployment
npmCacheCacheVolume nullCustom npm cache volume (uses default if not provided)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 deploy --project-id string --build-command string --node-version string --skip-build boolean --deploy-functions boolean --force boolean
func (m *MyModule) Example(ctx context.Context, projectId string, buildCommand string, nodeVersion string, skipBuild bool, deployFunctions bool, force bool) string  {
	return dag.
			GcpFirebase().
			Deploy(ctx, projectId, buildCommand, nodeVersion, skipBuild, deployFunctions, force)
}
@function
async def example(project_id: str, build_command: str, node_version: str, skip_build: bool, deploy_functions: bool, force: bool) -> str:
	return await (
		dag.gcp_firebase()
		.deploy(project_id, build_command, node_version, skip_build, deploy_functions, force)
	)
@func()
async example(projectId: string, buildCommand: string, nodeVersion: string, skipBuild: boolean, deployFunctions: boolean, force: boolean): Promise<string> {
	return dag
		.gcpFirebase()
		.deploy(projectId, buildCommand, nodeVersion, skipBuild, deployFunctions, force)
}

deployPreview() 🔗

Deploy to a Firebase Hosting preview channel. Returns the preview URL.

Supports three authentication methods: 1. OIDC/WIF (recommended): Provide oidc_token + workload_identity_provider 2. Service account: Provide credentials (JSON key) 3. Access token (deprecated): Provide access_token

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectIdString !-Firebase project ID
channelIdString !-Preview channel ID (e.g., pr-123)
sourceDirectory -Source directory
oidcTokenSecret nullOIDC JWT token from CI provider
workloadIdentityProviderString nullGCP Workload Identity Federation provider
serviceAccountEmailString nullService account to impersonate
credentialsSecret nullGCP service account credentials JSON
accessTokenSecret nullGCP access token (deprecated, use OIDC or credentials)
buildCommandString !"npm run build"Build command (empty string to skip build)
nodeVersionString !"20"Node.js version
skipBuildBoolean !falseSkip npm ci and build step (use when source is pre-built)
expiresString !"7d"Channel expiration
npmCacheCacheVolume nullCustom npm cache volume (uses default if not provided)
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 deploy-preview --project-id string --channel-id string --build-command string --node-version string --skip-build boolean --expires string
func (m *MyModule) Example(ctx context.Context, projectId string, channelId string, buildCommand string, nodeVersion string, skipBuild bool, expires string) string  {
	return dag.
			GcpFirebase().
			DeployPreview(ctx, projectId, channelId, buildCommand, nodeVersion, skipBuild, expires)
}
@function
async def example(project_id: str, channel_id: str, build_command: str, node_version: str, skip_build: bool, expires: str) -> str:
	return await (
		dag.gcp_firebase()
		.deploy_preview(project_id, channel_id, build_command, node_version, skip_build, expires)
	)
@func()
async example(projectId: string, channelId: string, buildCommand: string, nodeVersion: string, skipBuild: boolean, expires: string): Promise<string> {
	return dag
		.gcpFirebase()
		.deployPreview(projectId, channelId, buildCommand, nodeVersion, skipBuild, expires)
}

firestore() 🔗

Access Firestore database management utilities.

Return Type
GcpFirebaseFirestore !
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 firestore
func (m *MyModule) Example() *dagger.GcpFirebaseFirestore  {
	return dag.
			GcpFirebase().
			Firestore()
}
@function
def example() -> dagger.GcpFirebaseFirestore:
	return (
		dag.gcp_firebase()
		.firestore()
	)
@func()
example(): GcpFirebaseFirestore {
	return dag
		.gcpFirebase()
		.firestore()
}

scripts() 🔗

Access script runners for Firebase/Firestore data operations.

Provides methods to run scripts in various languages (Node.js, Python, etc.) with GCP Application Default Credentials configured for Firebase services.

Example (Node.js/TypeScript): await dag.gcp_firebase().scripts().node( credentials=credentials, source=source, script=“src/seed-data.ts”, working_dir=“functions”, )

Example (Python): await dag.gcp_firebase().scripts().python( credentials=credentials, source=source, script=“seed_data.py”, install_command=“pip install firebase-admin”, )

Example (Other languages): container = dag.gcp_firebase().scripts().container( credentials=credentials, source=source, base_image=“golang:1.22-alpine”, ) await container.with_exec([“go”, “run”, “main.go”]).stdout()

Return Type
GcpFirebaseFirebaseScripts !
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
 scripts
func (m *MyModule) Example() *dagger.GcpFirebaseFirebaseScripts  {
	return dag.
			GcpFirebase().
			Scripts()
}
@function
def example() -> dagger.GcpFirebaseFirebaseScripts:
	return (
		dag.gcp_firebase()
		.scripts()
	)
@func()
example(): GcpFirebaseFirebaseScripts {
	return dag
		.gcpFirebase()
		.scripts()
}