version: '3.7'
services:
ghost:
image: ghost:5-alpine
restart: always
volumes:
- './.tmp/data:/var/lib/ghost/content/data'
- './.tmp/images:/var/lib/ghost/content/images'
- './.tmp/settings:/var/lib/ghost/content/settings'
- './Digest:/var/lib/ghost/content/themes/digest' # Your theme
depends_on:
- db
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: secret_password
database__connection__database: ghost
url: https://blog.example.com
mail__transport: SMTP
mail__options__service: Mailgun
mail__options__host: smtp.eu.mailgun.org
mail__options__port: 465
mail__options__secure: 'true'
mail__options__auth__user: postmaster@example.com
mail__options__auth__pass: 'mailpassword'
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
# NODE_ENV: development
labels:
- "traefik.enable=true"
- "traefik.http.routers.ghost.entrypoints=http"
- "traefik.http.routers.ghost.rule=Host(`blog.example.com`)"
- "traefik.http.middlewares.ghost-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.ghost.middlewares=ghost-https-redirect"
- "traefik.http.routers.ghost-secure.entrypoints=https"
- "traefik.http.routers.ghost-secure.rule=Host(`blog.example.com`)"
- "traefik.http.routers.ghost-secure.tls=true"
- "traefik.http.routers.ghost-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.ghost-secure.service=ghost"
- "traefik.http.services.ghost.loadbalancer.server.port=2368"
- "traefik.docker.network=traefik_proxy"
networks:
- traefik_proxy
db:
expose:
- 3306
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_proxy"
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: secret_password
networks:
- traefik_proxy
volumes:
- my-db:/var/lib/mysql
networks:
traefik_proxy:
external: true
volumes:
my-db: