avisenna-landing-page/.github/workflows/docker.yml
2025-04-11 07:29:43 +00:00

40 lines
1 KiB
YAML

name: Build and Push Docker Image
#on:
# push:
# branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
IMAGE="ghcr.io/${{ github.repository }}"
docker build -t "$IMAGE:latest" .
docker push "$IMAGE:latest"
- name: Set up Kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config
env:
KUBECONFIG: ~/.kube/config
- name: Deploy to Kubernetes
run: |
IMAGE="ghcr.io/${{ github.repository }}"
kubectl set image deployment/homepage homepage=$IMAGE:latest -n web