Код IT
← Каталог

Сеть в контейнерах — Сценарий "frontend + api + db"

Фрагмент из «Сеть в контейнерах»: Сценарий "frontend + api + db".

yaml infra-securityencyclopedia8-06-konteynerizatsiya-i-orkestratsiya-115 embed URL статья в энциклопедии
YAML main.yaml
services:
  frontend:
    image: nginx:alpine
    ports:
      - "80:80"
    networks: ["public", "internal"]

  api:
    image: my-api:1.0
    networks: ["internal"]

  db:
    image: postgres:16
    networks: ["internal"]

networks:
  public:
  internal:
services:
  frontend:
    image: nginx:alpine
    ports:
      - "80:80"
    networks: ["public", "internal"]

  api:
    image: my-api:1.0
    networks: ["internal"]

  db:
    image: postgres:16
    networks: ["internal"]

networks:
  public:
  internal: