summaryrefslogtreecommitdiff
path: root/stacks/.template/compose.template.yml
blob: 593c96843d3d9faa40d328183d51144f98f8a62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## Template compose used for each stack.
name: ${_STACK} # Explicit project name (do not rely on directory name)

networks:
  net:
    name: ${_NET}
    external: true # All networks SHOULD be external in production.

volumes:
  data:
    name: ${_DATA_VOLUME}
    external: true # All volumes SHOULD be external in production.
  config:
    name: ${_CONFIG_VOLUME}
    external: true
  custom:
    name: ${_CUSTOM_VOLUME} # Custom volumes may not be external depending on the stack.
    # External volumes are not required for local stack testing.

services:
  servicename:
    container_name: ${_CONTAINER} # Remove if a swarm is needed.
    image: somewhere/someone/container:latest
    restart: unless-stopped
    env_file:
      # NOTE: .compose.env WILL override .env if there are overlapping values.
      - .compose.env # Compose wiring defaults go here
      - .env # Service env vars
    volumes:
      # Example bind mount (read-only)
      # - ./conf:/etc/service:ro
      - type: volume
        source: ${_DATA_VOLUME:-data} # Must exist if external; overridden in local dev
        target: /data
      - type: volume
        source: ${_CONFIG_VOLUME:-config} # Must exist if external; overridden in local dev
        target: /config
    networks:
      - net
    expose:
      - 80
      - 9001
      - 67