---
# Docker Compose for the Salam compiler.
#
# This file lives in compiler/docker/. The build context is the compiler root
# (compiler/, i.e. `..`), so the image is built from the self-contained compiler
# tree (src/, std/, tools/, Makefile). Run it from anywhere with:
#
#   Development (live reload):
#     docker compose -f compiler/docker/docker-compose.yml up dev
#   Production (build + run):
#     docker compose -f compiler/docker/docker-compose.yml run --rm prod build app.salam --output=app
#

services:
  dev:
    build:
      context: ..
      dockerfile: docker/Dockerfile
      target: dev
      args:
        ALPINE_VERSION: edge
        LLVM_VERSION: '22'
    image: salam:dev
    init: true
    stdin_open: true
    tty: true
    volumes:
      - ..:/app
      - salam-build:/app/build
    working_dir: /app

  prod:
    build:
      context: ..
      dockerfile: docker/Dockerfile
      target: prod
      args:
        ALPINE_VERSION: edge
        LLVM_VERSION: '22'
    image: salam:prod
    init: true
    volumes:
      - ../..:/work
    working_dir: /work
    command: ['--help']

volumes:
  salam-build:
