CircleCI is a simpler option compared to Jenkins. It's easy to set up and doesn't need much tweaking.
Unlike Jenkins, which needs a lot of manual work and upkeep, CircleCI already has things set up for you and works smoothly in the cloud.
This means developers can spend more time writing code instead of dealing with the setup, making deployments faster and more dependable.
In this project, I'll show how CircleCI is easy to use and why it's better than other similar tools.
Key Components :
-
Azure Container Registry (ACR)
-
CircleCI Account
-
Azure Web App
create Azure Container Registry and get an access key from the Registry to give permission pushing image into it.
Clone demo project from my GitLab repo.
im using NodeJS to create simple Web App.
then create and build a Docker Image on ACR, here's the dockerfile :
FROM node:current-alpine
COPY . /app
WORKDIR /app
RUN npm install
ENTRYPOINT ["npm", "start"]
Push it to the Azure Container Registry (ACR).
I'm currently using an existing ACR for another project named gitopscr
and will create a new repository called nodeapp
.
The variables underlined can be adjusted according to your requirements.
docker build -t gitopscr.azurecr.io/nodeapp:latest .
make sure you already login into your ACR, otherwise the push process will fail. Then push the image using this command
docker push gitopscr.azurecr.io/nodeapp:latest
then create Azure Web App, make sure it can access to ACR Repository. next create .circleci/config.yml inside root project to configure pipeline. Then login into CircleCI,
in this setup im using GitLab. Dont forget to set Environtment Variable in CircleCI App project setting. Next, make some change on main repo
then commit it, the pipeline should be running like this and success.
A build job failed because CircleCI attempted to push an image to ACR, which requires an access key.
Be sure to add the necessary environment variable in the CircleCI app.
$DOCKER_USER = ACR user
$DOCKER_PASS = ACR password