Skip to content

Build container and push to ACR #16

Build container and push to ACR

Build container and push to ACR #16

Workflow file for this run

name: Build container and push to ACR
on:
workflow_dispatch:
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: Add SSL certificates for DB
run: |
echo "${{ secrets.DB_SSL_CERT }}" > ${{ github.workspace }}/api/db-cert.pem
chmod 644 ${{ github.workspace }}/api/db-cert.pem
- name: 'Compose Customized Docker Image'
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--build-arg 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 }}'