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.0Entrypoint
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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
| databaseId | String ! | - | Database ID (4-63 chars, lowercase, hyphens) |
| location | String ! | - | Database location (e.g., us-central1, nam5) |
| databaseType | String ! | "firestore-native" | Type: firestore-native or datastore-mode |
| deleteProtection | Boolean ! | false | Enable 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 booleanfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
| databaseId | String ! | - | Database ID to delete |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
firestore \
delete --gcloud IMAGE:TAG --database-id stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
| databaseId | String ! | - | Database ID to describe |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
firestore \
describe --gcloud IMAGE:TAG --database-id stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
| databaseId | String ! | - | Database ID to check |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
firestore \
exists --gcloud IMAGE:TAG --database-id stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
firestore \
list --gcloud IMAGE:TAGfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| gcloud | Container ! | - | Authenticated gcloud container |
| databaseId | String ! | - | Database ID to update |
| deleteProtection | Boolean ! | - | 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 booleanfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Source directory |
| baseImage | String ! | - | Base container image |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token |
| projectId | String | null | GCP project ID |
| workingDir | String ! | "." | Working directory relative to source root |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
scripts \
container --base-image string --working-dir stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Source directory |
| script | String ! | - | Script path relative to working_dir |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token |
| projectId | String | null | GCP project ID |
| workingDir | String ! | "." | Working directory relative to source root |
| nodeVersion | String ! | "20" | Node.js version |
| installCommand | String ! | "npm ci" | Package install command |
| env | [String ! ] | null | Environment 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 stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Source directory |
| script | String ! | - | Script path relative to working_dir |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token |
| projectId | String | null | GCP project ID |
| workingDir | String ! | "." | Working directory relative to source root |
| pythonVersion | String ! | "3.12" | Python version |
| installCommand | String | null | Package install command |
| env | [String ! ] | null | Environment variables (KEY=VALUE format) |
Example
dagger -m github.com/telchak/daggerverse/gcp-firebase@010621c997378db92da5969584001be575c5e5a7 call \
scripts \
python --script string --working-dir string --python-version stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Source directory |
| buildCommand | String ! | "npm run build" | Build command (empty string to skip build) |
| nodeVersion | String ! | "20" | Node.js version |
| npmCache | CacheVolume | null | Custom 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 stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| projectId | String ! | - | Firebase project ID |
| channelId | String ! | - | Preview channel ID to delete |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token (deprecated, use OIDC or credentials) |
| site | String | null | Firebase site (defaults to project ID) |
| nodeVersion | String ! | "20" | Node.js version |
| npmCache | CacheVolume | null | Custom 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 stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| projectId | String ! | - | Firebase project ID |
| source | Directory | - | Source directory |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token (deprecated, use OIDC or credentials) |
| buildCommand | String ! | "npm run build" | Build command (empty string to skip build) |
| nodeVersion | String ! | "20" | Node.js version |
| skipBuild | Boolean ! | false | Skip npm ci and build step (use when source is pre-built) |
| deployFunctions | Boolean ! | true | Deploy Cloud Functions |
| force | Boolean ! | true | Force deployment |
| npmCache | CacheVolume | null | Custom 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 booleanfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| projectId | String ! | - | Firebase project ID |
| channelId | String ! | - | Preview channel ID (e.g., pr-123) |
| source | Directory | - | Source directory |
| oidcToken | Secret | null | OIDC JWT token from CI provider |
| workloadIdentityProvider | String | null | GCP Workload Identity Federation provider |
| serviceAccountEmail | String | null | Service account to impersonate |
| credentials | Secret | null | GCP service account credentials JSON |
| accessToken | Secret | null | GCP access token (deprecated, use OIDC or credentials) |
| buildCommand | String ! | "npm run build" | Build command (empty string to skip build) |
| nodeVersion | String ! | "20" | Node.js version |
| skipBuild | Boolean ! | false | Skip npm ci and build step (use when source is pre-built) |
| expires | String ! | "7d" | Channel expiration |
| npmCache | CacheVolume | null | Custom 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 stringfunc (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 \
firestorefunc (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 \
scriptsfunc (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()
}