Skip to content

Instantly share code, notes, and snippets.

@WebSofter

WebSofter/.env Secret

Last active July 10, 2021 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WebSofter/742f0a009ad61b7b4f2b8193b6e462e1 to your computer and use it in GitHub Desktop.
Save WebSofter/742f0a009ad61b7b4f2b8193b6e462e1 to your computer and use it in GitHub Desktop.
Ghost in Docker
# Tag used for the ghost docker image
export GHOST_IMAGE_TAG=latest
# Tag used for the MariaDB docker image
export MARIADB_IMAGE_TAG=latest
# Configure the blog url in ghost
export BLOG_URL=http://127.0.0.1:8022
# Root password used for MariaDB
export MYSQL_ROOT_PASSWORD=password
# User password used by ghost to connect to the database
export MYSQL_PASSWORD=password
# Host folders used by the containers
export MYSQL_HOST_PATH=./mariadb
export GHOST_HOST_PATH=./www
version: '3.3'
services:
mariadb:
container_name: project_mariadb
image: mariadb:${MARIADB_IMAGE_TAG}
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ghost
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ghost_production
restart: always
volumes:
- type: bind
source: ${MYSQL_HOST_PATH}
target: /var/lib/mysql
ghost:
container_name: project_ghost
image: ghost:${GHOST_IMAGE_TAG}
ports:
- 8022:2368
environment:
url: ${BLOG_URL:-http://127.0.0.1}
database__client: mysql
database__connection__host: mariadb
database__connection__database: ghost_production
database__connection__user: ghost
database__connection__password: ${MYSQL_PASSWORD}
depends_on:
- mariadb
restart: always
volumes:
- type: bind
source: ${GHOST_HOST_PATH}
target: /var/lib/ghost/content
server {
server_name site.com www.site.com;
error_log /var/www/site/logs/error.log;
access_log /var/www/site/logs/access.log;
location /{
proxy_pass http://localhost:8022;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment