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.

71 lines
2.7 KiB

4 years ago
  1. #
  2. # Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
  3. #
  4. # This file is part of After Dark.
  5. #
  6. # After Dark is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU Affero General Public License as published
  8. # by the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # After Dark is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Affero General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Affero General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. #
  19. # DOCKER-VERSION 19.03.1-ce, build 74b1e89e8a
  20. # COMPOSE-VERSION 1.24.1
  21. # HOW TO USE THIS FILE
  22. #
  23. # 1. Install Docker and Docker Compose on a host machine
  24. # 2. Copy `Dockerfile` and `docker-compose.yml` to directory of choice
  25. # 3. Run `docker build .` to build after-dark image
  26. # 4. Run `mkdir -p site/content` to contain your config and site content
  27. # 5. Create a temporary container to copy site config and welcome post from container to host
  28. # ```
  29. # docker create -it --name temp $(docker images -q | head -n 1) sh && \
  30. # docker cp temp:/opt/after-dark/config.toml ./site && \
  31. # docker cp temp:/opt/after-dark/content/post/ ./site/content/ && \
  32. # docker rm -fv temp
  33. # ```
  34. # 6. Add a rule to your hosts file like: `127.0.0.1 after-dark.local` to match traefik label
  35. # 7. Bring the stack up with `docker-compose up -d` then check state with `docker-compose ps`
  36. # 8. If both traefik and web services are up navigate to http://after-dark.local in a browser
  37. # 9. Make a change to the site config for content and watch the page reload with the updates
  38. version: "3.7"
  39. services:
  40. traefik:
  41. image: traefik:v2.0.0
  42. command:
  43. # - "--log.level=DEBUG"
  44. # - "--api.insecure=true"
  45. - "--global.checkNewVersion=false"
  46. - "--global.sendAnonymousUsage=false"
  47. - "--providers.docker=true"
  48. - "--providers.docker.exposedbydefault=false"
  49. - "--entrypoints.web.address=:80"
  50. ports:
  51. - "80:80"
  52. # - "8080:8080" # Traefik Web UI (enabled by --api.insecure)
  53. volumes:
  54. - /var/run/docker.sock:/var/run/docker.sock:ro # So that Traefik can listen to the Docker events
  55. # - ./traefik.toml:/etc/traefik/traefik.toml # Start using config
  56. web:
  57. build: .
  58. expose:
  59. - "80"
  60. volumes:
  61. - ./site/content:/opt/after-dark/content/:ro
  62. - ./site/config.toml:/opt/after-dark/config.toml:ro
  63. labels:
  64. - traefik.enable=true
  65. - traefik.http.routers.after-dark.entrypoints=web
  66. - traefik.http.routers.after-dark.rule=Host(`after-dark.local`)