# Exercise 1 — Two Services, Service-Name Networking (easy)
#
# STEP 1: define a service `web` built from the local Dockerfile (build: .)
#         that publishes host port 8080 to container port 80.
# STEP 2: define a service `cache` using image redis:7-alpine (no build).
# STEP 3: make `web` depend on `cache` using the plain (non-healthcheck)
#         form of depends_on.
# STEP 4: give `web` an environment variable CACHE_HOST=cache — proving you
#         understand service names double as hostnames on the project
#         network (theory section 3), NOT an IP address.
#
# No YAML interpreter runs a self-check here — verify against the
# CHECKLIST at the bottom, ideally by actually running `docker compose up`
# against a minimal Dockerfile + redis and confirming `web` can reach
# `cache` at that hostname (e.g. `docker compose exec web ping -c1 cache`).

services:
  web:
    # TODO 1: build from the local Dockerfile
    build: TODO
    # TODO 2: publish host 8080 -> container 80
    ports:
      - "TODO"
    # TODO 3: depend on cache (plain list form)
    depends_on:
      - TODO
    # TODO 4: CACHE_HOST env var pointing at the service name, not an IP
    environment:
      CACHE_HOST: TODO

  cache:
    # TODO 5: use image redis:7-alpine, explicit tag
    image: TODO

# ---------------------------------------------------------------------------
# CHECKLIST:
# [ ] `web` uses `build: .` (or an equivalent build context path), not an
#     `image:` key.
# [ ] `ports` maps "8080:80" exactly (host:container).
# [ ] `depends_on` lists `cache` using the plain array form (no
#     `condition:` object — that's a later exercise).
# [ ] `CACHE_HOST` is set to the literal string "cache" (the service name),
#     never a hardcoded IP address.
# [ ] `cache` pins `redis:7-alpine` explicitly, not `redis` or `redis:latest`.
# [ ] `docker compose config` (validates + prints the resolved config)
#     runs without error against this file.
# ---------------------------------------------------------------------------
