Build container and push to ACR #3
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 container and push to ACR | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
IMAGE: 'futarin-api' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@v4 | |
- name: 'Set up Docker Buildx' | |
uses: docker/setup-buildx-action@v3 | |
- name: 'Docker Login' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.LOGIN_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: 'Compose Customized Docker Image' | |
run: | | |
docker buildx build --platform linux/amd64,linux/arm64 \ | |
--build-args ENV=production \ | |
-f ./_docker/api/Dockerfile \ | |
-t ${{ vars.LOGIN_SERVER }}/${{ env.IMAGE }}:${{ github.sha }} \ | |
--push . | |
- name: 'Deploy to Azure Web App' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'futarin-api' | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
images: '${{ vars.LOGIN_SERVER }}/${{ env.IMAGE }}:${{ github.sha }}' |