Giter Site home page Giter Site logo
  • šŸ‘‹ Hi, Iā€™m @akashdeepz
  • šŸ‘€ Iā€™m interested in ...
  • šŸŒ± Iā€™m currently learning ...
  • šŸ’žļø Iā€™m looking to collaborate on ...
  • šŸ“« How to reach me ...

Use Control + Space to trigger autocomplete in most situations.

This workflow will build a docker container, publish it to IBM Container Registry, and deploy it to IKS when a release is created

To configure this workflow:

1. Ensure that your repository contains a Dockerfile

2. Setup secrets in your repository by going to settings: Create ICR_NAMESPACE and IBM_CLOUD_API_KEY

3. Change the values for the IBM_CLOUD_REGION, REGISTRY_HOSTNAME, IMAGE_NAME, IKS_CLUSTER, DEPLOYMENT_NAME, and PORT

name: Build and Deploy to IKS

on: release: types: [created]

Environment variables available to all jobs and steps in this workflow

env: GITHUB_SHA: ${{ github.sha }} IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }} IBM_CLOUD_REGION: us-south ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }} REGISTRY_HOSTNAME: sahi IMAGE_NAME: iks-test IKS_CLUSTER: example-iks-cluster-name-or-id DEPLOYMENT_NAME: sahi PORT:8080

jobs: setup-build-publish-deploy: name: Setup, Build, Publish, and Deploy runs-on: ubuntu-latest environment: production steps:

- name: Checkout
  uses: actions/checkout@v2

# Download and Install IBM Cloud CLI
- name: Install IBM Cloud CLI
  run: |
    curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
    ibmcloud --version
    ibmcloud config --check-version=false
    ibmcloud plugin install -f kubernetes-service
    ibmcloud plugin install -f container-registry
# Authenticate with IBM Cloud CLI
- name: Authenticate with IBM Cloud CLI
  run: |
    ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g default
    ibmcloud cr region-set "${IBM_CLOUD_REGION}"
    ibmcloud cr login
# Build the Docker image
- name: Build with Docker
  run: |
    docker build -t "$REGISTRY_HOSTNAME"/"$ICR_NAMESPACE"/"$IMAGE_NAME":"$GITHUB_SHA" \
      --build-arg GITHUB_SHA="$GITHUB_SHA" \
      --build-arg GITHUB_REF="$GITHUB_REF" .
# Push the image to IBM Container Registry
- name: Push the image to ICR
  run: |
    docker push $REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA
# Deploy the Docker image to the IKS cluster
- name: Deploy to IKS
  run: |
    ibmcloud ks cluster config --cluster $IKS_CLUSTER
    kubectl config current-context
    kubectl create deployment $DEPLOYMENT_NAME --image=$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA --dry-run -o yaml > deployment.yaml
    kubectl apply -f deployment.yaml
    kubectl rollout status deployment/$DEPLOYMENT_NAME
    kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml
    kubectl apply -f service.yaml
    kubectl get services -o wide

akashdeepz's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.