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.

95 lines
3.7 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. # InvenTree web server services
  16. # Uses gunicorn as the web server
  17. inventree-server:
  18. container_name: inventree-server
  19. # If you wish to specify a particular InvenTree version, do so here
  20. # e.g. image: inventree/inventree:0.5.2
  21. image: inventree/inventree:latest
  22. expose:
  23. - 8000
  24. volumes:
  25. # Data volume must map to /home/inventree/data
  26. - data:/home/inventree/data
  27. restart: unless-stopped
  28. environment:
  29. INVENTREE_DEBUG: False
  30. INVENTREE_LOG_LEVEL: WARNING
  31. INVENTREE_DB_ENGINE: mysql
  32. INVENTREE_DB_HOST: ${INVENTREE_DB_HOST:?err}
  33. INVENTREE_DB_PORT: ${INVENTREE_DB_PORT:?err}
  34. INVENTREE_DB_NAME: ${INVENTREE_DB_NAME:?err}
  35. INVENTREE_DB_USER: ${INVENTREE_DB_USER:?err}
  36. INVENTREE_DB_PASSWORD: ${INVENTREE_DB_PASSWORD:?err}
  37. # Background worker process handles long-running or periodic tasks
  38. inventree-worker:
  39. container_name: inventree-worker
  40. # If you wish to specify a particular InvenTree version, do so here
  41. # e.g. image: inventree/inventree:0.5.2
  42. image: inventree/inventree:latest
  43. command: invoke worker
  44. depends_on:
  45. - inventree-server
  46. volumes:
  47. # Data volume must map to /home/inventree/data
  48. - data:/home/inventree/data
  49. restart: unless-stopped
  50. environment:
  51. INVENTREE_DEBUG: False
  52. INVENTREE_LOG_LEVEL: WARNING
  53. INVENTREE_DB_ENGINE: mysql
  54. INVENTREE_DB_HOST: ${INVENTREE_DB_HOST:?err}
  55. INVENTREE_DB_PORT: ${INVENTREE_DB_PORT:?err}
  56. INVENTREE_DB_NAME: ${INVENTREE_DB_NAME:?err}
  57. INVENTREE_DB_USER: ${INVENTREE_DB_USER:?err}
  58. INVENTREE_DB_PASSWORD: ${INVENTREE_DB_PASSWORD:?err}
  59. # nginx acts as a reverse proxy
  60. # static files are served directly by nginx
  61. # media files are served by nginx, although authentication is redirected to inventree-server
  62. # web requests are redirected to gunicorn
  63. # NOTE: You will need to provide a working nginx.conf file!
  64. inventree-proxy:
  65. container_name: inventree-proxy
  66. image: nginx:stable
  67. depends_on:
  68. - inventree-server
  69. ports:
  70. # Change "1337" to the port that you want InvenTree web server to be available on
  71. - 1337:80
  72. volumes:
  73. # Provide ./nginx.conf file to the container
  74. # Refer to the provided example file as a starting point
  75. - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
  76. # nginx proxy needs access to static and media files
  77. - data:/var/www
  78. restart: unless-stopped
  79. volumes:
  80. # NOTE: Change /path/to/data to a directory on your local machine
  81. # Persistent data, stored external to the container(s)
  82. data:
  83. driver: local
  84. driver_opts:
  85. type: none
  86. o: bind
  87. # This directory specified where InvenTree data are stored "outside" the docker containers
  88. # Change this path to a local system path where you want InvenTree data stored
  89. device: /path/to/data