Viber can be deployed to Google Cloud Run for production use. This guide walks through the complete deployment process.
Prerequisites
Before deploying, ensure you have:
A Google Cloud Platform account
The gcloud CLI installed and configured
All required environment variables ready
Your project built and tested locally
Deployment steps
Authenticate with Google Cloud
Log in to your Google Cloud account: This will open a browser window for authentication.
Set your project ID
Configure gcloud to use your project: gcloud config set project YOUR_PROJECT_ID
Replace YOUR_PROJECT_ID with your actual Google Cloud project ID.
Enable required services
Enable Cloud Run and Cloud Build APIs: gcloud services enable run.googleapis.com cloudbuild.googleapis.com
Build and push container image
Build your Docker image and push it to Google Container Registry: gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/viber .
This step can take several minutes as it builds the complete application image.
Deploy to Cloud Run
Deploy the container to Cloud Run with your environment variables: gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1 \
--allow-unauthenticated \
--port 3000 \
--set-env-vars GEMINI_API_KEY=... \
--set-env-vars DAYTONA_API_KEY=... \
--set-env-vars UNSPLASH_ACCESS_KEY=... \
--set-env-vars UNSPLASH_SECRET_KEY=...
Add optional environment variables as needed: gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1 \
--allow-unauthenticated \
--port 3000 \
--set-env-vars GEMINI_API_KEY=your_key \
--set-env-vars DAYTONA_API_KEY=your_key \
--set-env-vars UNSPLASH_ACCESS_KEY=your_key \
--set-env-vars UNSPLASH_SECRET_KEY=your_key \
--set-env-vars ELEVENLABS_API_KEY=your_key \
--set-env-vars DEFAULT_MODEL=gemini-2.5-pro \
--set-env-vars IMAGE_CDN_BASE_URL=https://your-app.run.app
Access your deployment
After deployment completes, Cloud Run will provide a URL like: https://viber-xxxxx.run.app
Visit this URL to access your deployed Viber instance.
Configuration options
Region selection
You can deploy to different regions by changing the --region flag:
--region us-central1 # Iowa (default in example)
--region us-east1 # South Carolina
--region europe-west1 # Belgium
--region asia-northeast1 # Tokyo
Authentication
The example uses --allow-unauthenticated to make the service publicly accessible. For private deployments, remove this flag:
gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1 \
--port 3000
For production deployments, consider using Cloud Run’s built-in authentication or placing your service behind Cloud Load Balancing with Identity-Aware Proxy.
Resource limits
You can configure CPU and memory limits:
gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1 \
--allow-unauthenticated \
--port 3000 \
--cpu 2 \
--memory 2Gi \
--set-env-vars GEMINI_API_KEY=...
Updating your deployment
To update an existing deployment:
Rebuild the image
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/viber .
Deploy the new version
gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1
Cloud Run will automatically handle the rollout.
Environment variables in production
Never include sensitive API keys directly in your Dockerfile or source code. Always use Cloud Run’s --set-env-vars flag or environment variable configuration in the console.
Using environment variable files
For easier management, create an .env.yaml file:
GEMINI_API_KEY : your_gemini_api_key
DAYTONA_API_KEY : your_daytona_api_key
UNSPLASH_ACCESS_KEY : your_unsplash_access_key
UNSPLASH_SECRET_KEY : your_unsplash_secret_key
ELEVENLABS_API_KEY : your_elevenlabs_api_key
DEFAULT_MODEL : gemini-2.5-pro
Then deploy with:
gcloud run deploy viber \
--image gcr.io/YOUR_PROJECT_ID/viber \
--region us-central1 \
--allow-unauthenticated \
--port 3000 \
--env-vars-file .env.yaml
Add .env.yaml to your .gitignore to prevent accidentally committing secrets.
Client-side environment variables
The VITE_ELEVENLABS_AGENT_ID variable is compiled into the frontend during build. From the Dockerfile:
ENV VITE_ELEVENLABS_AGENT_ID=agent_5901kch85sfye06s56m7kshw9kf4
RUN rm -rf .output && bun run build
How to customize VITE_ELEVENLABS_AGENT_ID
To use your own ElevenLabs agent ID:
Modify the Dockerfile to use a build argument:
ARG ELEVENLABS_AGENT_ID
ENV VITE_ELEVENLABS_AGENT_ID=${ELEVENLABS_AGENT_ID}
RUN rm -rf .output && bun run build
Build with the argument:
gcloud builds submit \
--tag gcr.io/YOUR_PROJECT_ID/viber \
--substitutions _ELEVENLABS_AGENT_ID=your_agent_id \
.
Or modify the Dockerfile directly before building.
Monitoring and logs
View logs for your deployment:
gcloud run services logs read viber --region us-central1
Or view logs in real-time:
gcloud run services logs tail viber --region us-central1
Troubleshooting
Deployment fails during build
Check Cloud Build logs:
gcloud builds list
gcloud builds log BUILD_ID
Service fails to start
Verify all required environment variables are set:
gcloud run services describe viber --region us-central1
Check that the PORT environment variable matches the exposed port (3000):
From the Dockerfile:
ENV PORT=3000
EXPOSE 3000