Update docker.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Docker Image to GHCR | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the code from the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Step 3: Log in to GitHub Container Registry (GHCR) | |
- name: Log in to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} # Use GitHub username | |
password: ${{ secrets.GITHUB_TOKEN }} # GitHub token is automatically available in workflows | |
# Step 4: Build Docker image with hardcoded name "mcp_bridge" | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/secretiveshell/mcp_bridge:${{ github.sha }} . | |
# Step 5: Push the Docker image to GHCR | |
- name: Push Docker image to GHCR | |
run: | | |
docker push ghcr.io/secretiveshell/mcp_bridge:${{ github.sha }} |