Created
August 20, 2024 05:17
-
-
Save hanancs/f0b517f7bea871753d020ea354eb3380 to your computer and use it in GitHub Desktop.
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 Push Docker Image to IBM Cloud Code Engine | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install IBM Cloud CLI | |
run: | | |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh | |
ibmcloud --version | |
- name: Inatall & Verify IBM Cloud Container Registry Plugin | |
run: | | |
ibmcloud plugin install container-registry | |
ibmcloud cr --version | |
- name: Login to IBM Cloud | |
run: ibmcloud login --apikey ${{ secrets.IBM_CLOUD_API_KEY }} -g Default -r us-south | |
- name: Login to IBM Cloud Container Registry | |
run: ibmcloud cr login | |
- name: Build and push image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: us.icr.io/ibm-cr-ns/k8sapp | |
deploy-to-code-engine: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install IBM Cloud CLI | |
run: | | |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh | |
ibmcloud --version | |
- name: Install IBM Cloud Code Engine Plugin | |
run: | | |
ibmcloud plugin install code-engine | |
ibmcloud plugin list | |
- name: Login to IBM Cloud | |
run: ibmcloud login --apikey ${{ secrets.IBM_CLOUD_API_KEY }} -g Default -r us-south | |
- name: Deploy the latest image to Code Engine | |
run: | | |
ibmcloud ce project select -n ce-project-76 | |
ibmcloud ce application update --name application-0a --image private.us.icr.io/ibm-cr-ns/k8sapp --registry-secret ibm-key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment