Experimenting with docker-compose.
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.

118 lines
2.6 KiB

  1. version: "3"
  2. # This Docker cluster spins up the following containers:
  3. #
  4. # - My web blog for Kirsle.net (which is a custom Go program)
  5. # - Redis as a cache for the blog to use.
  6. # - Gitea, a self-hosted Git server.
  7. # - PostgreSQL as the database for Gitea.
  8. # - nginx, a reverse web proxy that makes all of these services available.
  9. #
  10. # The services are mounted at my test domains in nginx:
  11. #
  12. # - https://blog.kirsle.lh for the web blog
  13. # - https://git.kirsle.lh for Gitea
  14. #
  15. # Exported ports:
  16. # - 80 (nginx)
  17. # - 443 (nginx)
  18. # - 22 (gitea-ssh)
  19. # Define named networks to isolate the apps from each other. Each app will
  20. # list the networks it needs to share with others.
  21. networks:
  22. default:
  23. driver: bridge
  24. redis:
  25. driver: bridge
  26. blog:
  27. driver: bridge
  28. gitea:
  29. driver: bridge
  30. # Named volumes to let the apps store their own data persistently on disk
  31. # between reboots. They end up somewhere at /var/lib/docker/volumes on the
  32. # host filesystem, useful for self-contained apps.
  33. volumes:
  34. gitea-db-data:
  35. driver: local
  36. gitea-data:
  37. driver: local
  38. redis-data:
  39. driver: local
  40. services:
  41. # nginx reverse proxy in front of all the apps
  42. nginx:
  43. image: nginx
  44. restart: always
  45. ports:
  46. - "80:80"
  47. - "443:443"
  48. volumes:
  49. - "./nginx/sites-enabled:/etc/nginx/sites-enabled:z"
  50. - "./nginx/nginx.conf:/etc/nginx/nginx.conf:z"
  51. - "./nginx/ssl_params:/etc/nginx/ssl_params:z"
  52. - "./ssl/snakeoil.key:/etc/nginx/certs/privkey.pem:z"
  53. - "./ssl/snakeoil.pem:/etc/nginx/certs/fullchain.pem:z"
  54. networks:
  55. - default
  56. - blog
  57. - gitea
  58. # shared Redis cache for various apps
  59. redis:
  60. image: redis
  61. restart: always
  62. expose:
  63. - 6379
  64. volumes:
  65. - "redis-data:/data"
  66. networks:
  67. - redis
  68. # My custom Go web blog for kirsle.net
  69. # https://github.com/kirsle/blog/blob/master/Dockerfile
  70. blog:
  71. build: /home/kirsle/go/src/github.com/kirsle/blog
  72. restart: always
  73. expose:
  74. - 80
  75. volumes:
  76. - "./www:/data/www:z"
  77. networks:
  78. - blog
  79. - redis
  80. # Postgres DB for gitea.
  81. gitea-postgres:
  82. image: postgres:10.5
  83. restart: always
  84. environment:
  85. - "POSTGRES_USER=gitea"
  86. - "POSTGRES_PASSWORD=gitea"
  87. - "POSTGRES_DB=gitea"
  88. volumes:
  89. - "gitea-db-data:/var/lib/postgresql/data"
  90. networks:
  91. - gitea
  92. # Gitea git server.
  93. gitea:
  94. image: gitea/gitea:latest
  95. restart: always
  96. volumes:
  97. - "gitea-data:/data"
  98. expose:
  99. - 3000
  100. ports:
  101. - "22:22"
  102. networks:
  103. - gitea
  104. environment:
  105. - DISABLE_REGISTRATION=true
  106. depends_on:
  107. - gitea-postgres
  108. - nginx