Merge pull request #86 from bcgov/GeorgeWalker-patch-3 #14
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: cd-cpu-app | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'cpu-app/**' | |
- '.github/workflows/cd-cpu.yml' | |
env: | |
APP_NAME: cpu | |
BUILD_ID: ${{ github.server_url }}!${{ github.repository }}!${{ github.ref_name }}!${{ github.sha }}!${{ github.run_number }} | |
IMAGE_REGISTRY: ${{ secrets.OCP4_REGISTRY }}/${{ secrets.OCP4_NAMESPACE }} | |
jobs: | |
build-cpu-api: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'bcgov' | |
env: | |
IMAGE_NAME: api | |
CPU_API_DOCKERFILE_PATH: ./cpu-app/Dockerfile | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx tooling | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into OpenShift Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ secrets.OCP4_USERNAME }} | |
password: ${{ secrets.OCP4_PASSWORD }} | |
- name: Pull image | |
run: docker pull $IMAGE_ID || true | |
- name: Build and push cpu-app | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
BUILD_ID="${{ env.BUILD_ID }}" | |
cache-from: | | |
${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }} | |
file: ${{ env.CPU_API_DOCKERFILE_PATH }} | |
push: true | |
tags: | | |
${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev | |
build-cpu-ui: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'bcgov' | |
env: | |
IMAGE_NAME: ui | |
CPU_UI_DOCKERFILE_PATH: ./cpu-app/ClientApp/Dockerfile | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx tooling | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into OpenShift Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ secrets.OCP4_USERNAME }} | |
password: ${{ secrets.OCP4_PASSWORD }} | |
- name: Pull image | |
run: docker pull $IMAGE_ID || true | |
- name: Build and push cpu-app | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
BUILD_ID="${{ env.BUILD_ID }}" | |
cache-from: | | |
${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }} | |
file: ${{ env.CPU_UI_DOCKERFILE_PATH }} | |
push: true | |
tags: | | |
${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev |