Deploy workers from GitHub
Learn how to deploy a Serverless worker directly from a GitHub repository to a Serverless endpoint.
How GitHub integration works
RunPod's GitHub integration simplifies your workflow by pulling your code and Dockerfile from GitHub, building the container image, storing it in RunPod's secure container registry, and deploying it to your endpoint.
Requirements
To deploy a worker from GitHub, you need:
- A working handler function in a GitHub repository.
- A Dockerfile in your repository. See Creating a Dockerfile for details.
- A GitHub account.
Authorizing RunPod with GitHub
Before deploying from GitHub, you need to authorize RunPod to access your repositories:
- Open the settings page in the RunPod console.
- Find the GitHub card under Connections and click Connect.
- Sign in using the GitHub authorization flow. This will open your GitHub account settings page.
- Choose which repositories RunPod can access:
- All repositories: Access to all current and future repositories.
- Only select repositories: Choose specific repositories.
- Click Save.
You can manage this connection using RunPod settings or GitHub account settings, in the Applications tab.
Deploying from GitHub
To deploy a worker from a GitHub repository:
- Go to the Serverless section of the RunPod console
- Click New Endpoint
- Under Custom Source, select GitHub Repo, then click Next
- Use the search bar or menu to select the repository containing your code. This menu is populated with all repos connected to your account (repos you've forked/created, or owned by your GitHub organizations).
- Configure your deployment options:
- Branch: Select which branch to deploy from.
- Dockerfile: Specify the path to your Dockerfile (if not in root).
- (Optional) Enter a custom name for your endpoint.
- Configure your compute resources (GPU type, worker count, etc.).
- Click Create Endpoint.
RunPod will build your Docker image and deploy it to your endpoint automatically. You'll be redirected to the endpoint details page when complete.
Monitoring build status
You can monitor your build status in the Builds tab of your endpoint detail page. Builds progress through these statuses:
Status | Description |
---|---|
Pending | RunPod is scheduling the build. |
Building | RunPod is building your container. |
Uploading | RunPod is uploading your container to the registry. |
Testing | RunPod is testing your Serverless worker. |
Completed | RunPod completed the build and upload. |
Failed | Something went wrong (check build logs). |
Managing multiple environments
GitHub integration enables streamlined development workflows by supporting multiple environments:
- Production endpoint tracking the
main
branch. - Staging endpoint tracking the
dev
branch.
To set up multiple environments:
- Create a new branch for your staging endpoint.
- Create an endpoint for your production branch.
- On the Serverless page of the RunPod console, click the three dots to the top right of your production endpoint. Click Clone Endpoint.
- Expand the Repository Configuration section and select your staging branch.
- Click Create Endpoint.
Each environment maintains independent GPU and worker configurations.
Continuous integration with GitHub Actions
You can enhance your workflow with GitHub Actions for testing before deployment:
-
Create a workflow file at
.github/workflows/test-and-deploy.yml
:name: Test and Deploy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: [DOCKER_USERNAME]/[WORKER_NAME]:${{ github.sha }}
- name: Run Tests
uses: runpod/runpod-test-runner@v1
with:
image-tag: [DOCKER_USERNAME]/[WORKER_NAME]:${{ github.sha }}
runpod-api-key: ${{ secrets.RUNPOD_API_KEY }} # Add your API key to a GitHub secret
test-filename: .github/tests.json
request-timeout: 300tipTo add your RunPod API key to a GitHub secret, see Using secrets in GitHub Actions.
-
Create test cases for your repository at
.github/tests.json
:[
{
"input": {
"prompt": "Test input 1"
},
"expected_output": {
"status": "COMPLETED"
}
},
{
"input": {
"prompt": "Test input 2",
"parameter": "value"
},
"expected_output": {
"status": "COMPLETED"
}
}
]
Known limitations
RunPod's GitHub integration has a few limitations to be aware of:
GitHub integration limitations
When using GitHub integration with RunPod, be aware of these important limitations:
- Build time limit: Builds must complete within 160 minutes (2.5 hours). Optimize your Dockerfile for efficiency with large images to avoid timeouts.
- Image size restriction: Docker images cannot exceed 100 GB. Plan your image requirements accordingly, particularly when including large model weights or dependencies.
- Base image limitations: The integration doesn't support privately hosted images as base images. Consider incorporating essential components directly into your Dockerfile instead.
- Hardware-specific builds: Builds requiring GPU access during construction (such as those using GPU-compiled versions of libraries like
bitsandbytes
) are not supported. - Platform exclusivity: Images built through RunPod's image builder service are designed exclusively for RunPod's infrastructure and cannot be pulled or executed on other platforms.
- Single GitHub connection: Each RunPod account can link to only one GitHub account. This connection cannot be shared among team members, requiring separate RunPod accounts for collaborative projects.
Disconnecting GitHub
To disconnect your GitHub account from RunPod:
- Go to RunPod Settings → Connections → Edit Connection
- Select your GitHub account.
- Click Configure.
- Scroll down to the Danger Zone.
- Uninstall "RunPod Inc."
Troubleshooting deployment issues
If your worker fails to deploy or process requests:
- Check the build logs in the RunPod console for error messages.
- Verify your Dockerfile is properly configured.
- Ensure your handler function works correctly in local testing.
- Check that your repository structure matches what's expected in your Dockerfile.
- Verify you have the necessary permissions on the GitHub repository.
Next steps
After deploying your worker from GitHub, you can: