How to Deploy a Dockerized API to Azure App Service Using GitHub Actions or Azure DevOps
Objective
To demonstrate how to containerize an API (e.g., .NET, Node.js, Python), deploy it to Azure App Services using Docker, and set up an automated CI/CD workflow with GitHub Actions or Azure DevOps. We’ll also cover local development and testing.
Prerequisites
Step 1: Containerize Your API Locally
Sample Dockerfile (.NET 8 example)
Build and run locally
Step 2: Create an Azure App Service for Containers
Step 3: Push Your Docker Image
You can use Docker Hub or Azure Container Registry (ACR).
Docker Hub
ACR (optional)
Step 4: Configure App Service to Use Your Container
Step 5: Setup CI/CD with GitHub Actions
Sample GitHub Workflow (.github/workflows/deploy.yml)
Step 6: Local Development Tips
Debug with Docker locally
Example for VS Code launch.json
Summary
1.Dockerize the API
2.Deploy App Service on Linux
3.Push Docker image
4.Connect App Service to container
5.Set up GitHub Actions for CI/CD
6.Debug locally with Docker