You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.0 KiB

  1. version: "3.8"
  2. # Docker compose recipe for InvenTree
  3. # - Runs PostgreSQL as the database backend
  4. # - Runs Gunicorn as the InvenTree web server
  5. # - Runs the InvenTree background worker process
  6. # - Runs nginx as a reverse proxy
  7. # ---------------------------------
  8. # IMPORTANT - READ BEFORE STARTING!
  9. # ---------------------------------
  10. # Before running, ensure that you change the "/path/to/data" directory,
  11. # specified in the "volumes" section at the end of this file.
  12. # This path determines where the InvenTree data will be stored!
  13. #
  14. services:
  15. # Database service
  16. # Use PostgreSQL as the database backend
  17. # Note: this can be changed to a different backend,
  18. # just make sure that you change the INVENTREE_DB_xxx vars below
  19. inventree-db:
  20. container_name: inventree-db
  21. image: postgres:13
  22. ports:
  23. - 5432/tcp
  24. environment:
  25. - PGDATA=/var/lib/postgresql/data/pgdb
  26. # The pguser and pgpassword values must be the same in the other containers
  27. # Ensure that these are correctly configured in your prod-config.env file
  28. - POSTGRES_USER=pguser
  29. - POSTGRES_PASSWORD=pgpassword
  30. volumes:
  31. # Map 'data' volume such that postgres database is stored externally
  32. - data:/var/lib/postgresql/data/
  33. restart: unless-stopped
  34. # InvenTree web server services
  35. # Uses gunicorn as the web server
  36. inventree-server:
  37. container_name: inventree-server
  38. # If you wish to specify a particular InvenTree version, do so here
  39. # e.g. image: inventree/inventree:0.5.2
  40. image: inventree/inventree:latest
  41. expose:
  42. - 8000
  43. depends_on:
  44. - inventree-db
  45. volumes:
  46. # Data volume must map to /home/inventree/data
  47. - data:/home/inventree/data
  48. env_file:
  49. # Environment variables required for the production server are configured in prod-config.env
  50. - prod-config.env
  51. restart: unless-stopped
  52. # Background worker process handles long-running or periodic tasks
  53. inventree-worker:
  54. container_name: inventree-worker
  55. # If you wish to specify a particular InvenTree version, do so here
  56. # e.g. image: inventree/inventree:0.5.2
  57. image: inventree/inventree:latest
  58. command: invoke worker
  59. depends_on:
  60. - inventree-db
  61. - inventree-server
  62. volumes:
  63. # Data volume must map to /home/inventree/data
  64. - data:/home/inventree/data
  65. env_file:
  66. # Environment variables required for the production server are configured in prod-config.env
  67. - prod-config.env
  68. restart: unless-stopped
  69. # nginx acts as a reverse proxy
  70. # static files are served directly by nginx
  71. # media files are served by nginx, although authentication is redirected to inventree-server
  72. # web requests are redirected to gunicorn
  73. # NOTE: You will need to provide a working nginx.conf file!
  74. inventree-proxy:
  75. container_name: inventree-proxy
  76. image: nginx:stable
  77. depends_on:
  78. - inventree-server
  79. ports:
  80. # Change "1337" to the port that you want InvenTree web server to be available on
  81. - 1337:80
  82. volumes:
  83. # Provide ./nginx.conf file to the container
  84. # Refer to the provided example file as a starting point
  85. - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
  86. # nginx proxy needs access to static and media files
  87. - data:/var/www
  88. restart: unless-stopped
  89. volumes:
  90. # NOTE: Change /path/to/data to a directory on your local machine
  91. # Persistent data, stored external to the container(s)
  92. data:
  93. driver: local
  94. driver_opts:
  95. type: none
  96. o: bind
  97. # This directory specified where InvenTree data are stored "outside" the docker containers
  98. # Change this path to a local system path where you want InvenTree data stored
  99. device: /path/to/data