I am trying to deploy multiple web-app containers on azure cloud to implement CI/CD pipeline deployment for production environment.
Currently I have built multiple container images using docker compose file which works totally fine on localhost environment.
I tried to deploy the docker images to azure container registry and run them using azure web app services but it failed giving error "Cannot map container ports on ACI" . Looks like ACI doesn’t support port mapping!
Can anyone suggest me a concrete solution to implement CI/CD deployment for multiple container deployment?
Technology stack of app: Nodejs and Angular
Docker: Docker desktop for windows (using Linux containers to build the images)
Cloud: Azure
I don’t have much experience in the Devops world, it would be helpful if anyone can guide me at proper path to implement a CI/CD process for multi-container web application.
Thanks for your time!
Docker compose file:
version: "3.4"
services:
frontend:
build: ./frontend
ports:
- "85:80"
expose:
- "85"
- "80"
networks:
- dev_network
depends_on:
- backend
backend:
build: ./backend
ports:
- "3000:8600"
expose:
- "3000"
- "8600"
networks:
- dev_network
networks:
dev_network:
driver: bridge
Frontend Docker file:
# Stage 1: Compile and Build angular codebase
# Use official node image as the base image
FROM node:latest as build
# Set the working directory
WORKDIR /usr/local/app
# Add the source code to app
COPY ./ /usr/local/app/
# Install all the dependencies
RUN npm install
# Stage 2: Serve app with nginx server
FROM nginx:latest
COPY --from=build /usr/local/app/dist/ClientServicePortal /usr/share/nginx/html
# Expose port 80
EXPOSE 80
Backend Docker file:
FROM node:14-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3000 8600
CMD ["node", "server.js"]
2
Answers
I’m not an expert but I think it depends on what kind of of infra/traffic you need for you application.
AKS allow you to set up scalling, load balancing, traffic control inside the cluster.
Another advantage, if you are using Azure DevOps tool, is that AKS as a new feature in preview "Deployment center (preview)". This feature will create CI and CD based on a repository.
It’s a good help to start and see it working, after that you can jump in the config/settings and play with it 🙂
edit : your docker compose will be replaced by an K8s manifest, but it’s "easy" to setup
As a by-default recommendation, the following is the main criteria recommended in this guidance:
Single monolithic app: Choose Azure App Service
N-Tier app: Choose orchestrators such as Azure Kubernetes Service (AKS) or App Service if you have a single or a few back-end services
Microservices: Choose AKS or Azure Web Apps for Containers
Serverless functions & event handlers: Choose Azure Functions
Large-scale Batch: Choose Azure Batch
AKS vs Azure App Services
Azure App Services:
PROS
CONS
Azure Kubernetes Service:
PROS
CONS
sources:
https://learn.microsoft.com/en-us/dotnet/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-container-based-applications
https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kubernetes-service-part-1-e489857c6440
https://spltech.co.uk/azure-appservice-vs-azure-kubernetes-service/
https://medium.com/nature-of-clouds/azure-kubernetes-vs-app-services-a-simple-cost-comparison-3800819e3c35