---
# Needs a Docker Compose supporting the 3.4 version onwards, such as the one
# from Debian bullseye-backports.
version: '3.4'

services:
  compiler:
    image: "bookup/compiler:0.0.1"

    build:
      context: .
      target: compiler
      dockerfile: Dockerfile
      args:
        - CONTAINER_UID=${CONTAINER_UID:-1000}
        - CONTAINER_GID=${CONTAINER_GID:-1000}

    volumes:
      - .:/srv/shared

    entrypoint: "make -C /srv/shared"

    restart: "no"

  tester:
    image: "bookup/compiler:0.0.1"

    build:
      context: .
      target: compiler
      dockerfile: Dockerfile
      args:
        - CONTAINER_UID=${CONTAINER_UID:-1000}
        - CONTAINER_GID=${CONTAINER_GID:-1000}

    volumes:
      - .:/srv/shared

    entrypoint: "make -C /srv/shared tests"

    restart: "no"

  site:
    image: "bookup/site:0.0.1"

    build:
      context: .
      target: site
      dockerfile: Dockerfile

    volumes:
      - .:/srv/shared

    ports:
      - 80:80

    entrypoint: "apache2ctl -DFOREGROUND"

  tor:
    image: "bookup/tor:0.0.1"

    build:
      context: .
      target: tor
      dockerfile: Dockerfile

    volumes:
      - tor:/var/lib/tor

    entrypoint: "/usr/bin/tor -f /etc/tor/torrc"

volumes:
  tor: {}