Sign inSign up

jackchen86/firebase-dev-cn

By jackchen86

•Updated over 1 year ago

firebase deployment environment packaging, running as a secure sandbox environment.

Image
Developer tools
0

538

jackchen86/firebase-dev-cn repository overview

⁠🔥 Firebase Development Environment Docker Image

Docker Pulls Docker Image Size Docker Image Version

Integrated Firebase development environment Docker image, solving issues like slow network access and complex configuration.

⁠🌟 Core Features

  • ✅ China Network Optimization: Configured with domestic mirror sources, download speed improved by 10x+
  • ✅ Firebase CLI: Pre-installed latest Firebase CLI and all emulators
  • ✅ Complete Development Tools: Includes nodemon, pm2, webpack, jest and other common tools
  • ✅ Proxy Support: Built-in proxy environment variables, supports enterprise network environments
  • ✅ Multi-port Support: Exposes all common ports for Firebase and development servers
  • ✅ Security Design: Uses non-root user, follows security best practices
  • ✅ Ready to Use: Start complete development environment with one command

⁠🚀 Quick Start

⁠Basic Usage
# Pull the image
docker pull jackchen86/firebase-dev-cn:latest

# Persist login state
docker volume create firebase-config

# Quick start development environment
docker run -it --rm \
  -p 5000:5000 \
  -p 5001:5001 \
  -p 8080:8080 \
  -p 4000:4000 \
  -p 9005:9005 \
  -v $(pwd):/workspace \
  -v firebase-config:/home/firebase/.config \
  jackchen86/firebase-dev-cn:latest

Persist Login State docker volume create firebase-config


version: '3.8'
services:
  firebase-dev:
    image: jackchen86/firebase-dev-cn:latest
    ports:
      - "5000:5000"    # Firebase Hosting
      - "5001:5001"    # Firebase Functions
      - "8080:8080"    # Firestore Emulator
      - "8085:8085"    # Auth Emulator
      - "9000:9000"    # Database Emulator
      - "9005:9005"    # Firebase Login Verification Callback Port
      - "9099:9099"    # Storage Emulator
      - "4000:4000"    # Emulator UI
      - "5173:5173"    # Vite Development Server
    volumes:
      - .:/workspace
    environment:
      - NODE_ENV=development
    tty: true
    stdin_open: true

volumes:
  firebase-config:
    external: true
⁠Enterprise Proxy Environment
# Persist login state
docker volume create firebase-config

# If you need to use proxy
docker run -it --rm \
  -e http_proxy=http://proxy.company.com:8080 \
  -e https_proxy=http://proxy.company.com:8080 \
  -p 5000:5000 \
  -p 5001:5001 \
  -p 8080:8080 \
  -p 4000:4000 \
  -p 9005:9005 \
  -v $(pwd):/workspace \
  -v firebase-config:/home/firebase/.config \
  jackchen86/firebase-dev-cn:latest

⁠🛠️ Included Tools

⁠Firebase Tools
  • Firebase CLI: Latest version, supports all Firebase services
  • Firebase Emulators: Hosting, Functions, Firestore, Auth, Database, Storage, Pub/Sub
⁠Development Tools
  • Node.js: v20 LTS version
  • npm: Latest version, configured with domestic mirror sources
  • Development Servers: nodemon, pm2, http-server, live-server
  • Build Tools: webpack, webpack-cli
  • Testing Tools: jest
  • Code Quality: eslint, prettier
⁠System Tools
  • Version Control: git
  • Network Tools: curl, wget
  • Editors: vim, nano
  • System Monitoring: htop, tree
  • Java Runtime: OpenJDK 11 (required for Firebase emulators)

⁠📋 Port Description

PortServiceDescription
5000Firebase HostingStatic website hosting
5001Firebase FunctionsCloud functions
8080Firestore EmulatorNoSQL database
8085Auth EmulatorUser authentication
9000Database EmulatorRealtime database
9005Firebase Login Verification Callback PortLogin verification
9099Storage EmulatorFile storage
4000Emulator UIUnified management interface
5173-5180Development ServerVite/Webpack etc.

⁠🌏 China Optimization Details

⁠Mirror Source Optimization
  • Alpine Linux: Uses USTC mirror source
  • npm: Uses npmmirror.com mirror source
  • Node.js: Uses domestic CDN accelerated download
⁠Network Optimization
  • Pre-configured Proxy Variables: Supports http_proxy, https_proxy
  • DNS Optimization: Configured with domestic DNS resolution
  • Timeout Settings: Optimized timeout settings for domestic network environment

⁠📖 Usage Tutorial

⁠1. Create Firebase Project
# Execute after entering container
firebase login
firebase init
⁠2. Start Development Server
# Start Hosting
firebase serve --only hosting

# Start all emulators
firebase emulators:start
⁠3. Deploy Project
# Build project
npm run build

# Deploy to Firebase
firebase deploy

⁠🔧 Common Issues

⁠Q: How to use on Windows?

A: Recommend using WSL2 or Docker Desktop, mount paths using Linux format.

⁠Q: How to persist Firebase login state?

A: Mount Firebase configuration directory:

docker volume create firebase-config
... -v firebase-config:/home/firebase/.config  jackchen86/firebase-dev-cn:latest
⁠Q: How to customize npm mirror source?

A: Execute after entering container:

npm config set registry https://your-registry.com/
⁠Q: What to do with port conflicts?

A: Modify port mapping:

-p 15000:5000  # Map local port 15000 to container port 5000

⁠📊 Performance Comparison

OperationNative EnvironmentThis ImageImprovement
npm install5-10 minutes1-2 minutes5x+
Firebase CLI Installation2-5 minutesReady to useInfinite
Emulator Startup30-60 seconds10-15 seconds3x+
Project InitializationComplex configurationOne-click start10x+

🔥 Make Firebase development easier, make developers more efficient!

If this image helps you, please give a ⭐Star for support!


⁠🔥 Firebase开发环境Docker镜像

Docker Pulls Docker Image Size Docker Image Version

集成Firebase开发环境Docker镜像,解决网络访问慢、配置复杂等问题。

⁠🌟 核心特性

  • ✅ 国内网络优化: 配置了国内镜像源,下载速度提升10倍+
  • ✅ Firebase CLI: 预装最新版Firebase CLI和所有模拟器
  • ✅ 开发工具齐全: 包含nodemon、pm2、webpack、jest等常用工具
  • ✅ 代理支持: 内置代理环境变量,支持企业网络环境
  • ✅ 多端口支持: 暴露Firebase和开发服务器所有常用端口
  • ✅ 安全设计: 使用非root用户,符合安全最佳实践
  • ✅ 即开即用: 一条命令启动完整开发环境

⁠🚀 快速开始

⁠基本使用
# 拉取镜像
docker pull jackchen86/firebase-dev-cn:latest

# 持久化登入状态
docker volume create firebase-config

# 快速启动开发环境
docker run -it --rm \
  -p 5000:5000 \
  -p 5001:5001 \
  -p 8080:8080 \
  -p 4000:4000 \
  -p 9005:9005 \
  -v $(pwd):/workspace \
  -v firebase-config:/home/firebase/.config \
  jackchen86/firebase-dev-cn:latest
⁠使用Docker Compose(推荐)

持久化登入状态 docker volume create firebase-config


version: '3.8'
services:
  firebase-dev:
    image: jackchen86/firebase-dev-cn:latest
    ports:
      - "5000:5000"    # Firebase Hosting
      - "5001:5001"    # Firebase Functions
      - "8080:8080"    # Firestore模拟器
      - "8085:8085"    # Auth模拟器
      - "9000:9000"    # Database模拟器
      - "9005:9005"    # Firebase 登入验证回调端口
      - "9099:9099"    # Storage模拟器
      - "4000:4000"    # 模拟器UI
      - "5173:5173"    # Vite开发服务器
    volumes:
      - .:/workspace
    environment:
      - NODE_ENV=development
    tty: true
    stdin_open: true

volumes:
  firebase-config:
    external: true
⁠企业代理环境
# 持久化登入状态
docker volume create firebase-config

# 如果需要使用代理
docker run -it --rm \
  -e http_proxy=http://proxy.company.com:8080 \
  -e https_proxy=http://proxy.company.com:8080 \
  -p 5000:5000 \
  -p 5001:5001 \
  -p 8080:8080 \
  -p 4000:4000 \
  -p 9005:9005 \
  -v $(pwd):/workspace \
  -v firebase-config:/home/firebase/.config \
  jackchen86/firebase-dev-cn:latest

⁠🛠️ 包含的工具

⁠Firebase工具
  • Firebase CLI: 最新版本,支持所有Firebase服务
  • Firebase模拟器: Hosting、Functions、Firestore、Auth、Database、Storage、Pub/Sub
⁠开发工具
  • Node.js: v20 LTS版本
  • npm: 最新版本,配置国内镜像源
  • 开发服务器: nodemon、pm2、http-server、live-server
  • 构建工具: webpack、webpack-cli
  • 测试工具: jest
  • 代码质量: eslint、prettier
⁠系统工具
  • 版本控制: git
  • 网络工具: curl、wget
  • 编辑器: vim、nano
  • 系统监控: htop、tree
  • Java运行时: OpenJDK 11 (Firebase模拟器需要)

⁠📋 端口说明

端口服务说明
5000Firebase Hosting静态网站托管
5001Firebase Functions云函数
8080Firestore模拟器NoSQL数据库
8085Auth模拟器用户认证
9000Database模拟器实时数据库
9005Firebase 登入验证回调端口登入验证
9099Storage模拟器文件存储
4000模拟器UI统一管理界面
5173-5180开发服务器Vite/Webpack等

⁠🌏 国内优化详情

⁠镜像源优化
  • Alpine Linux: 使用中科大镜像源
  • npm: 使用npmmirror.com镜像源
  • Node.js: 使用国内CDN加速下载
⁠网络优化
  • 预配置代理变量: 支持http_proxy、https_proxy
  • DNS优化: 配置国内DNS解析
  • 超时设置: 针对国内网络环境优化超时时间

⁠📖 使用教程

⁠1. 创建Firebase项目
# 进入容器后执行
firebase login
firebase init
⁠2. 启动开发服务器
# 启动Hosting
firebase serve --only hosting

# 启动所有模拟器
firebase emulators:start
⁠3. 部署项目
# 构建项目
npm run build

# 部署到Firebase
firebase deploy

⁠🔧 常见问题

⁠Q: 如何在Windows上使用?

A: 推荐使用WSL2或Docker Desktop,挂载路径使用Linux格式。

⁠Q: 如何持久化Firebase登录状态?

A: 挂载Firebase配置目录:

docker volume create firebase-config
... -v firebase-config:/home/firebase/.config  jackchen86/firebase-dev-cn:latest
⁠Q: 如何自定义npm镜像源?

A: 进入容器后执行:

npm config set registry https://your-registry.com/
⁠Q: 端口冲突怎么办?

A: 修改端口映射:

-p 15000:5000  # 将本地15000端口映射到容器5000端口

⁠📊 性能对比

操作原生环境本镜像提升
npm install5-10分钟1-2分钟5倍+
Firebase CLI安装2-5分钟即开即用无限
模拟器启动30-60秒10-15秒3倍+
项目初始化复杂配置一键启动10倍+

🔥 让Firebase开发更简单,让开发者更高效!

如果这个镜像对您有帮助,请给个⭐Star支持一下!

Tag summary

Content type

Image

Digest

sha256:607e1881f…

Size

602.8 MB

Last updated

over 1 year ago

docker pull jackchen86/firebase-dev-cn