1# FOSSology Docker Compose file
2# Copyright Siemens AG 2016, fabio.huser@siemens.com
3# Copyright TNG Technology Consulting GmbH 2016-2017, maximilian.huber@tngtech.com
4#
5# Copying and distribution of this file, with or without modification,
6# are permitted in any medium without royalty provided the copyright
7# notice and this notice are preserved.  This file is offered as-is,
8# without any warranty.
9#
10# Description: Recipe for setting up a multi container FOSSology
11#              Docker setup with separate Database instance
12version: '3.5'
13services:
14  scheduler:
15    build:
16      context: .
17      dockerfile: Dockerfile
18      args:
19      - http_proxy
20      - https_proxy
21      - no_proxy
22    image: fossology
23    restart: unless-stopped
24    environment:
25      - FOSSOLOGY_DB_HOST=db
26      - FOSSOLOGY_DB_NAME=fossology
27      - FOSSOLOGY_DB_USER=fossy
28      - FOSSOLOGY_DB_PASSWORD=fossy
29    command: scheduler
30    depends_on:
31      - db
32    volumes:
33      - repository:/srv/fossology/repository/
34    healthcheck:
35      test: ["CMD-SHELL", "true"]
36      interval: 5s
37      timeout: 5s
38      retries: 2
39  web:
40    build:
41      context: .
42      dockerfile: Dockerfile
43      args:
44      - http_proxy
45      - https_proxy
46      - no_proxy
47    image: fossology
48    restart: unless-stopped
49    environment:
50      - FOSSOLOGY_DB_HOST=db
51      - FOSSOLOGY_DB_NAME=fossology
52      - FOSSOLOGY_DB_USER=fossy
53      - FOSSOLOGY_DB_PASSWORD=fossy
54      - FOSSOLOGY_SCHEDULER_HOST=scheduler
55    command: web
56    ports:
57      - 8081:80
58    depends_on:
59      - db
60      - scheduler
61    volumes:
62      - repository:/srv/fossology/repository/
63    healthcheck:
64      test: ["CMD-SHELL", "curl -sSf localhost/repo/api/v1/version || exit 1"]
65      interval: 5s
66      timeout: 5s
67      retries: 5
68  db:
69    image: postgres:9.6
70    restart: unless-stopped
71    environment:
72      - POSTGRES_DB=fossology
73      - POSTGRES_USER=fossy
74      - POSTGRES_PASSWORD=fossy
75      - POSTGRES_INITDB_ARGS='-E SQL_ASCII'
76    volumes:
77      - database:/var/lib/postgresql/data
78    healthcheck:
79      test: ["CMD-SHELL", "pg_isready --dbname $$POSTGRES_DB --username $$POSTGRES_USER"]
80      interval: 10s
81      timeout: 5s
82      retries: 5
83      # start-period: 10s
84
85volumes:
86  database:
87  repository:
88