Selft-host Ghost with Docker and Filestorage with Minio

(Documentation:  Work in Progress)

version: '2'

services:
  blog-ghost:
    image: ghost:3-alpine
    restart: always
    volumes:
      - ./blog-ghost/content:/var/lib/ghost/content
      - ./minio-data/blog-ghost:/var/lib/ghost/content/images/files
    env_file:
      - DOTENV/blog-ghost.env

  own-ghost:
    image: ghost:3-alpine
    restart: always
    volumes:
      - ./own-ghost/content:/var/lib/ghost/content
      - ./minio-data/own-ghost:/var/lib/ghost/content/images/files
    env_file:
      - DOTENV/own-ghost.env

  minio:
    image: minio/minio
    restart: always
    env_file:
      - DOTENV/minio.env
    command: server /data
    volumes:
      - ./minio-data:/data

  # ghost-db:
  #   image: mysql:5.7
  #   restart: always
  #   environment:
  #     MYSQL_ROOT_PASSWORD: ghost

# create network: docker network create xnmp-network
networks:
  default:
    external:
      name: xnmp-network
docker-compose.yml
run: docker-compose up

Environment

url=https://blog.ghost.localhost
### see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
# database__client=mysql
# database__connection__host=ghost-db
# database__connection__user=root
# database__connection__password=ghost
# database__connection__database=blog-ghost
DOTENV/blog-ghost.env
url=https://own.ghost.localhost
### see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
# database__client=mysql
# database__connection__host=ghost-db
# database__connection__user=root
# database__connection__password=ghost
# database__connection__database=own-ghost
DOTENV/own-ghost.env
MINIO_ACCESS_KEY=minio-username
MINIO_SECRET_KEY=minio-password
DOTENV/minio.env

Nginx Configuration

# minio.ghost.localhost
server {
    listen 80;
	listen [::]:80;
    include /nginx/snippets/ssl-domain.conf;
    server_name ~^minio\.ghost\.localhost?$;
    resolver 127.0.0.11 valid=30s;
    set $upstream http://minio:9000;
    include /nginx/snippets/snippet-server-location-upstream.conf;
    client_max_body_size 5m;
}

# *.ghost.localhost
server {
    listen 80;
	listen [::]:80;
    include /nginx/snippets/ssl-domain.conf;
    server_name ~^((?<app>.*)\.)ghost\.localhost?$;
    resolver 127.0.0.11 valid=30s;
    set $upstream http://${app}-ghost:2368;
    include /nginx/snippets/snippet-server-location-upstream.conf;
    client_max_body_size 5m;
}
Guide to install Nginx + Php + MariaDB + Phpmyadmin in Docker manual
# server {
#     server_name ~^dbadmin(\.localhost)?$;
#     resolver 127.0.0.11 valid=30s;
#     set $upstream http://dbadmin:80;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass $upstream;
    }
# }
file: /nginx/snippets/snippet-server-location-upstream.conf