Merge pull request #18 from miles-no/feat(terraform)/azure-function #17
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 Azure Container Registry | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Step 2: Set up Docker Buildx (optional, improves build performance) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# Step 3: Log in to Azure Container Registry | |
- name: Log in to Azure Container Registry | |
run: echo "${{ secrets.ACR_PASSWORD }}" | docker login "${{ secrets.ACR_SERVER }}" -u "${{ secrets.ACR_USERNAME }}" --password-stdin | |
# Step 4: Build the Docker image | |
- name: Build the Docker image | |
run: docker build -t "${{ secrets.ACR_SERVER }}/aquaapi:latest" ./src/AquaApi | |
# Step 5: Push the Docker image to Azure Container Registry | |
- name: Push the Docker image | |
run: docker push "${{ secrets.ACR_SERVER }}/aquaapi:latest" |