Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AllianceBioversityCIAT/alliance-research-indicators-client/llms.txt

Use this file to discover all available pages before exploring further.

The Alliance Research Indicators client ships with a multi-stage Dockerfile and a docker-compose.yml that give you a containerized path from source to a production-equivalent Nginx-served bundle. This is useful for validating production builds, testing in a clean environment, or handing off a deployment artifact. All Docker commands are run from the research-indicators/ directory.

The Dockerfile: three stages

The Dockerfile at research-indicators/Dockerfile has three named stages:
#################### DEVELOPMENT STAGE ####################
FROM node:20-alpine AS build

WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build --prod

#################### TESTING STAGE ####################
FROM node:20-alpine AS test

WORKDIR /usr/src/app
COPY --from=build /usr/src/app /usr/src/app

#################### PRODUCTION STAGE ####################
FROM nginx:alpine

RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /usr/src/app/dist/research-indicators/browser /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
RUN chmod -R 755 /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
StageBase imageWhat it does
buildnode:20-alpineInstalls all npm dependencies with npm ci, then runs ng build to produce dist/research-indicators/browser/
testnode:20-alpineCopies the full build workspace so tests can run against the compiled output in CI
Production (default)nginx:alpineCopies only the compiled browser assets from the build stage into Nginx’s web root — no Node.js, no source code, no node_modules in the final image
The build stage uses node:20-alpine, which mirrors the Node 20.x requirement for local development. If your machine uses a different Node major version, the Docker build ensures your deployment artifact is always compiled against Node 20 regardless.

Nginx configuration

The custom nginx.conf at research-indicators/nginx.conf configures a single virtual host on port 80 with SPA routing support:
server {
    listen       80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    error_page  404              /404.html;
    error_page  500 502 503 504  /50x.html;
}
The key directive is try_files $uri $uri/ /index.html. Because the application uses the Angular Router with HTML5 pushState URLs, any path that does not map to a static file (for example /results/123 or /dashboard) must fall back to index.html so Angular can handle the route client-side. Without this, deep-linking to any route other than / would return a 404 from Nginx.

Docker Compose profiles

The docker-compose.yml defines a single named service (dev) that is used for both the development and production compose profiles via the corresponding npm scripts.
services:
  dev:
    container_name: research_indicatiors_client
    image: research_indicatiors_client:1.0.0
    build:
      context: .
      dockerfile: ./Dockerfile
    ports:
      - 4200:80
    volumes:
      - .:/usr/src/app
      - /usr/src/app/node_modules
    restart: unless-stopped
The container exposes port 80 internally; the Compose file maps it to port 4200 on the host. You can change the host port by editing the ports entry if 4200 is occupied.

Starting the containers

# Builds the image and starts the dev service with the source directory mounted
npm run compose:up:dev
Both commands run docker-compose up <profile> -d, building the image if it does not already exist and starting the container in detached mode.
To force a rebuild after dependency or code changes, add the --build flag directly:
docker-compose up dev --build -d

Building a standalone image

If you need to build and tag the image without Compose — for example to push it to a registry:
# Build for the current architecture
docker build -t research_indicatiors_client .

# Build for a specific platform (e.g., amd64 for a cloud provider from an Apple Silicon machine)
docker build --platform=linux/amd64 -t research_indicatiors_client .

Individual Docker commands

The following npm scripts are also available for ad-hoc container management:
ScriptCommandDescription
docker:buildnpm run docker:buildBuild the Docker image and tag it research_indicatiors_client
docker:runnpm run docker:runRun the built image with an env-file, mapping host 4200 → container 4200
docker:stopnpm run docker:stopStop and remove the named container
docker:logsnpm run docker:logsStream container logs
docker:execnpm run docker:execOpen an interactive bash shell in the running container

Build docs developers (and LLMs) love