Categories
Automation CI/CD DevOps

Podman Jenkins Agent

Today, I’ll show Podman Jenkins agent assuming Jenkins runs on Kubernetes. We’ll see Podman agent’s Dockerfile and CI/CD pipeline using it.

Categories
DevOps quick q&a

Live reload Node.js app inside Docker container during development

You probably found yourself in a situation when building new docker image of Node.js app with the new changes takes a long time. All you wanted is to test your changes fast on a live system…

To achieve that, use docker volumes or bind mounts to map your source code on the workspace to source folder inside Node.js app container. You can verify the changes reach the container by inspecting the source code inside the container after you make a change on docker host.

In order for node process inside the container to pick up the changes, it needs to reload. Use nodemon for that.

I wrote about it here as well.

Categories
DevOps quick q&a

Azure-cli in Dockerfile in Alpine

Today we’ll see how to install Azure-cli in Dockerfile when the base image is Alpine.

As you know azure cli allows you to control azure cloud aspects from command line. This may be useful for provisioning azure resources in ci/cd pipelines or automations, for instance. If the pipelines run inside Jenkins agents (e.g. Docker in Docker Jenkins agent, Podman Jenkins agent) which are containerized, you may need to package azure-cli inside them. Let’s see how to install azure-cli in Dockerfile.

Azure-cli installation in Dockerfile

You probably found it challenging to install Azure-cli as part of Dockerfile where the base image is Alpine.

Use below command sequence to achieve that:

RUN apk add --no-cache --update python3 py3-pip 
RUN apk add --no-cache --update --virtual=build gcc musl-dev python3-dev libffi-dev openssl-dev cargo make && pip3 install --no-cache-dir --prefer-binary azure-cli && apk del virtual

RUN apk add --no-cache --update python3 py3-pip installed python and pip. They are needed because azure-cli is basically Python package.

Second RUN installs os packages required for successful azure-cli installation. Then, pip installs azure-cli.

See also relevant discussion on GitHub about installation of azure-cli in alpine.

Why apk add –virtual?

Note that these os packages are installed in a virtual package which is removed after azure-cli installation using apk del virtual. This trick reduces the final built image size.

Note also that Azure CLI is a Python package. That’s why it requires Python and Pip to run. Hence these packages are not removed.

See this great answer on stack overflow about apk add --virtual. Note that apk add --no-cache reduces image size as well.

Summary

That’s it about Azure-cli installation in Dockerfile when Alpine is a base image.

Find out recommended Azure books on Amazon.

Find out recommended Azure courses on Pluralsight:

Sign up using this link to get exclusive discounts like 50% off your first month or 15% off an annual subscription)

Categories
Automation CI/CD DevOps

Running minikube in Docker container

In the last article we saw how to run Jenkins Docker in Docker Agent. In addition to its obvious use case of building and pushing Docker images, I also noted that such an agent allows to run minikube inside. Today, I’ll show how to run minikube in Docker container. Of course, we’ll use docker in docker client and daemon images for that.

Categories
Automation CI/CD DevOps

Jenkins Docker in Docker Agent

So you installed Jenkins helm chart on Kubernetes cluster. Now you want to build Docker images. How would you do that? There are several ways. Today, we’ll focus on creating and using Jenkins Docker in Docker agent for that purpose.

Categories
Best Practices Orchestration

RabbitMQ cluster as a single Docker Swarm service

I once configured RabbitMQ cluster as a single Docker Swarm service. Time has come to share this way with the world.

Categories
Automation CI/CD DevOps Orchestration

Kubernetes Volumes Introduction

What are Kubernetes volumes, their types and concepts behind them? We’ll cover all of that below. In addition, we’ll see practical demo of using Kubernetes volumes.

Categories
DevOps Orchestration

Kubernetes Pods Introduction for Docker Users

Kubernetes pods are the smallest units of execution in Kubernetes. We’ll explore concepts behind Kubernetes pods and how to manage them using kubectl. Keep reading to find out more.

Categories
Automation Best Practices UI Testing Web Development

Selenium tests in Docker container. Chrome Browser in Docker too.

So you built a website. You even run it in Docker container. That’s perfect, but how do you test it? Do you have Selenium tests running in Docker container? Nice. Does the browser Selenium tests drive run in Docker container too? If you feel it’s too much, don’t worry. We’ll see an example with all of that covered 🙂 Keep reading to find out more.

Categories
Best Practices Web Development

Point host name to WordPress in Docker

Is it possible to point host name to WordPress website running in Docker container? Sure. Keep reading to find out how.