CI/CD on Azure · Part 1 of 7
Introducing the project
Why this project, which tech stack, and above all why the three environments, dev, staging and prod, rely on three radically different deployment approaches.
- Next.js
- Docker
- Azure
Context
This project was born from a concrete need: building a showcase website for a private network of about sixty drivers in Bali, offering sightseeing tours and on-demand transfers. The site, named West Bali Drivers, targets an international clientele and is above all a showcase. No online payment, no user accounts, no back office. The goal of this first version is simple: present the offer and generate contacts through WhatsApp.
What I document here is not the development of the application itself, but the setup of the infrastructure and of the CI/CD pipeline that delivers it in a reproducible, automated and professional way.
The tech stack: what each tool does
I am not a developer. What interests me in this project is the infrastructure and the automation. Before getting to the heart of the matter, here is an honest introduction to each technical building block, seen through the eyes of someone used to administering systems rather than writing code.
Next.js: the engine of the site
Next.js is a web framework based on React (itself based on JavaScript). For a system administrator, the closest analogy would be an advanced static site generator: from source files (templates, data, components), it produces a set of HTML, CSS and JavaScript files ready to be served by any web server.
In this project, Next.js is configured in static export mode (output: 'export'). In practice, the next build command produces an out/ folder containing the whole site as static files. No Node.js in production, no application process to monitor, Nginx serves files, period. It is deliberately simple for this phase of the project.
TypeScript: JavaScript with types
TypeScript is a layer on top of JavaScript that adds static typing of variables and data structures. If JavaScript is a permissive interpreted language (a bit like bash), TypeScript is closer to a compiled language: type errors are caught at compile time, not at runtime.
For the infrastructure, the impact is indirect but real: a TypeScript project gets built before it gets deployed. The CI/CD pipeline will therefore need a compilation step, and any build failure must block the deployment.
Tailwind CSS: the styling system
Tailwind CSS is a library of visual styles (colors, margins, fonts, layouts). For a non-developer, there is nothing to know about Tailwind from an operational point of view: its files are bundled into the build and have no impact on the deployment infrastructure.
Mapbox: interactive maps
Mapbox is an external mapping service, comparable to Google Maps but with a more generous free tier and better customization options. The site uses it to display transfer routes between two points on an interactive map.
Technically, Mapbox is consumed through an API key (NEXT_PUBLIC_MAPBOX_TOKEN). It is the only sensitive variable of the project on the application side. Handling this secret in the CI/CD pipeline will be a specific point of attention.
Cloudinary: image hosting
Cloudinary is a CDN specialized in image management. Rather than storing the photos in the Git repository or in an Azure blob, they are hosted on Cloudinary, which serves them on demand with automatic resizing and optimization (WebP format, lazy loading, etc.).
From an infrastructure point of view, Cloudinary is entirely external, with no configuration to manage on our side. Images are referenced by URL in the code.
Docker: containerization
Docker is the core subject of this series of articles. It is what lets us package the application and its runtime environment into a portable and reproducible image.
In this project, the Dockerfile uses a multi-stage build:
- Stage 1 (builder): a temporary Node.js image installs the dependencies and runs the Next.js build to produce the
out/folder. - Stage 2 (runner): a minimal Nginx Alpine image picks up only the
out/folder and serves it over HTTP.
The final image therefore contains no Node.js, no source code, no node_modules. It only contains Nginx and static files. The result: a lightweight image (under 50 MB), with no unnecessary attack surface, identical whatever the environment it runs in.
pnpm: the package manager
pnpm is the equivalent of apt or pip for the JavaScript ecosystem: it installs and manages the project’s dependencies. For the infrastructure, its only impact is in the Dockerfile: it is what gets invoked to install the dependencies before the build.
ESLint + Prettier: code quality
ESLint is a linter (it detects errors and bad practices in the code). Prettier is an automatic formatter. Both tools can be added as a check step in the CI/CD pipeline, before the build, to block a deployment if the code does not meet the defined standards.
What this project will teach us
The application itself is deliberately simple: a static site with no backend. It is a deliberate choice, because the goal is to focus on the rigor of the pipeline rather than on application complexity. Besides, the site itself is, at first, as simple as it gets: a showcase site with no backend logic, made of static files. We start small to build something clean, and we embroider around it afterwards :)
A containerized static site is the ideal case to focus on what matters here:
- Writing a clean and optimized Dockerfile, both for development (hot reload) and for production (static build)
- Publishing images to a private registry (Azure Container Registry)
- Deploying automatically to several environments, with a strategy suited to each
- Handling authentication between GitHub Actions and Azure without static secrets (OIDC)
- Setting up a custom domain with HTTPS
- Consciously trading off technical consistency against hosting cost, an exercise as formative as the automation itself
Why three environments so different from one another
One point deserves to be spelled out before even getting into the architecture: the three environments of this project do not rely on the same deployment technology, and it is a deliberate choice. I would rather document it here than let you discover it along the way.
Dev stays strictly local. Next.js, in development mode, needs to mount the source code as a volume to benefit from hot reload (instant reload on every change). Such a mount only makes sense on the machine where the code is written, and it is a pain to reproduce cleanly on a remote host. This environment therefore never leaves my workstation.
Staging is the first remote environment, the one that simulates real conditions. It runs the production image (the
runnerstage of the Dockerfile, Nginx + static files) on Azure Container Apps. This is where the CI/CD pipeline, the container registry and automated deployment really come into their own.Prod deliberately breaks away from the container world. The final site is deployed on Azure Static Web Apps, a fully managed service that directly serves the
out/folder generated by Next.js, with no Docker, no Nginx to configure, and HTTPS and custom domain included for free.
Why this break? For economic and technical pragmatism. For a 100% static site with no server logic, running a container 24/7 only to end up serving HTML files is an expense and a complexity the need does not justify. Azure Static Web Apps does exactly that job, for free, with a global CDN on top.
But then why go through containers in staging, only to drop them afterwards? This choice has a cost that I accept and document: what is validated in staging (an Nginx container) is no longer strictly identical to what runs in prod (the proprietary infrastructure of Static Web Apps). It is a departure from the “what works locally works in prod” principle stated above, but a deliberate, reversible departure, consistent with the “small is beautiful” philosophy of the project: do not make the infrastructure more complex than the real need of Phase 0.
This break is not permanent, by the way. As soon as Phase 1 introduces an API, a database and an application backend, Static Web Apps will no longer be enough, and production will move to Azure Container Apps: the same service already validated in staging. The containerized pipeline built right now is therefore the foundation the application will rest on when the need for application complexity shows up.
Target architecture
Here is what we are going to build over the course of this series:
Local workstation
│
├── dev branch ───────→ Dockerfile, "dev" stage (hot reload, mounted volume)
│ Stays strictly local, never deployed remotely
│
▼
GitHub Repository
│
▼
GitHub Actions (CI/CD)
│
├── staging branch ───→ Dockerfile, "runner" stage (Nginx + static build)
│ │
│ └──→ Azure Container Registry (tag: staging)
│ │
│ └──→ Azure Container Apps
│ (real conditions, scale-to-zero)
│
└── main branch ──────→ Next.js build (out/), no container
│
└──→ Azure Static Web Apps
│
└── custom domain + HTTPS (included, free)Three environments, three different deployment approaches. As explained above, it is a deliberate choice.
Next
In the next chapter, we will start at the beginning: writing the Dockerfile, in its two variants (development with hot reload, production with a static build), and validating that each stage builds and runs correctly locally.