Intermediate Reading #yaml #docker #github-actions #devops

⚙️ Reading: YAML & JSON Configs

3 exercises — read real DevOps configuration files: a Docker Compose setup with healthchecks and a GitHub Actions CI pipeline. Understand what each block controls and why.

YAML reading quick reference
  • Indentation = hierarchy (parent → child relationship)
  • key: value → a single setting
  • - item → list item (starts with a dash)
  • HOST:CONTAINER port syntax — left side is your machine, right is inside the container
  • $${{ expression }} → GitHub Actions variable interpolation
0 / 3 completed
1 / 3
⚙️ docker-compose.yml
version: '3.9'

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:3000"
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgres://user:pass@db:5432/myapp
    depends_on:
      db:
        condition: service_healthy
    restart: unless-stopped
    volumes:
      - ./uploads:/app/uploads

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: myapp
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user -d myapp"]
      interval: 10s
      timeout: 5s
      retries: 3

volumes:
  pgdata:
According to this docker-compose.yml, which port on the HOST machine maps to port 3000 inside the container?