-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from Priyanka-Microsoft/main
Automate Docker Image Publishing Pipeline Using GitHub Actions
- Loading branch information
Showing
8 changed files
with
3,845 additions
and
720 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build ClientAdvisor Docker Images | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- ClientAdvisor/** | ||
pull_request: | ||
branches: [main] | ||
types: | ||
- opened | ||
- ready_for_review | ||
- reopened | ||
- synchronize | ||
paths: | ||
- ClientAdvisor/** | ||
merge_group: | ||
|
||
jobs: | ||
docker-build: | ||
strategy: | ||
matrix: | ||
include: | ||
- app_name: byc-wa-app | ||
dockerfile: ClientAdvisor/App/WebApp.Dockerfile | ||
password_secret: DOCKER_PASSWORD | ||
- app_name: byc-wa-fn | ||
dockerfile: ClientAdvisor/AzureFunction/Dockerfile | ||
password_secret: DOCKER_PASSWORD | ||
|
||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
registry: bycwacontainerreg.azurecr.io | ||
username: bycwacontainerreg | ||
password_secret: ${{ matrix.password_secret }} | ||
app_name: ${{ matrix.app_name }} | ||
dockerfile: ${{ matrix.dockerfile }} | ||
push: true # Adjust this logic as necessary | ||
secrets: inherit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Reusable Docker build and push workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
registry: | ||
required: true | ||
type: string | ||
username: | ||
required: true | ||
type: string | ||
password_secret: | ||
required: true | ||
type: string | ||
app_name: | ||
required: true | ||
type: string | ||
dockerfile: | ||
required: true | ||
type: string | ||
push: | ||
required: true | ||
type: boolean | ||
secrets: | ||
DOCKER_PASSWORD: | ||
required: true | ||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Login | ||
if: ${{ inputs.push }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ inputs.registry }} | ||
username: ${{ inputs.username }} | ||
password: ${{ secrets[inputs.password_secret] }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Get current date | ||
id: date | ||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
|
||
- name: Build Docker Image and optionally push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
push: ${{ inputs.push }} | ||
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:latest | ||
tags: | | ||
${{ inputs.registry }}/${{ inputs.app_name}}:dev | ||
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.date.outputs.date }}_${{ github.run_number }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build ResearchAssistant Docker Images | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- ResearchAssistant/** | ||
pull_request: | ||
branches: [main] | ||
types: | ||
- opened | ||
- ready_for_review | ||
- reopened | ||
- synchronize | ||
paths: | ||
- ResearchAssistant/** | ||
merge_group: | ||
|
||
jobs: | ||
docker-build: | ||
strategy: | ||
matrix: | ||
include: | ||
- app_name: byoaia-app | ||
dockerfile: ResearchAssistant/App/WebApp.Dockerfile | ||
password_secret: DOCKER_PASSWORD_RESEARCHASSISTANT | ||
|
||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
registry: byoaiacontainerreg.azurecr.io | ||
username: byoaiacontainerreg | ||
password_secret: ${{ matrix.password_secret }} | ||
app_name: ${{ matrix.app_name }} | ||
dockerfile: ${{ matrix.dockerfile }} | ||
push: true # Adjust this logic as necessary | ||
secrets: inherit |
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
Oops, something went wrong.