-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
df978ae
commit b8547a1
Showing
4 changed files
with
63 additions
and
9 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
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
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,10 @@ | ||
## Reusable Docker Container Deployment to Azure | ||
|
||
- **Purpose:** Deploy a Docker container to Azure App Service. | ||
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs. | ||
- **Required Secrets:** | ||
- `AZURE_CREDENTIALS`: JSON object containing Azure service principal credentials for authentication. | ||
- `ACR_SERVER`: DNS to the Azure Container Registry where the Docker image is stored ex.: 'aciacfiaacr.azurecr.io'. | ||
- `ACR_USERNAME`: Username for logging into Azure Container Registry. | ||
- `ACR_PASSWORD`: Password for logging into Azure Container Registry. | ||
- `AZURE_PUBLISH_PROFILE`: Publish profile for the Azure App Service. This contains deployment and configuration settings. |
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,43 @@ | ||
name: Reusable Docker container deployment to Azure | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
container-name: | ||
required: true | ||
type: string | ||
tag: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Azure | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Azure Docker Login | ||
uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ secrets.ACR_SERVER }} | ||
username: ${{ secrets.ACR_USERNAME }} | ||
password: ${{ secrets.ACR_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
docker build -t ${{ secrets.ACR_SERVER }}/${{ inputs.container-name }}:${{ inputs.tag }} . | ||
docker push ${{ secrets.ACR_SERVER }}/${{ inputs.container-name }}:${{ inputs.tag }} | ||
- name: Deploy to Azure App Service | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: ${{ github.event.repository.name }} | ||
slot-name: production | ||
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }} | ||
images: ${{ secrets.ACR_SERVER }}/${{ inputs.container-name }}:${{ inputs.tag }} |