Skip to content

Instantly share code, notes, and snippets.

@bluemeda
Created May 17, 2022 08:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bluemeda/3bbb781364bd29cf8d3e20cfff660dfa to your computer and use it in GitHub Desktop.
Save bluemeda/3bbb781364bd29cf8d3e20cfff660dfa to your computer and use it in GitHub Desktop.
Ghost Docker
version: '3.1'
networks:
web:
external: true
volumes:
mysql-volume:
services:
ghost:
build: ./build
image: bluemeda/ghost:4
restart: always
container_name: ghost
environment:
url: https://bluemeda.web.id
storage__active: b2
storage__b2__accountId: *******
storage__b2__bucketId: *******
storage__b2__bucketName: *******
storage__b2__key: *******
storage__b2__domain: *******
database__client: mysql
database__connection__host: mysql
database__connection__user: *******
database__connection__password: *******
database__connection__database: *******
mail__transport: SMTP
mail__options__service: Mailgun
mail__options__auth__user: *******
mail__options__auth__pass: *******
volumes:
- ./data/ghost/ghost_content:/var/lib/ghost/content
networks:
- web
depends_on:
- mysql
entrypoint: ["wait-for-mysql.sh", "mysql", "--", "docker-entrypoint.sh"]
command: ["node", "current/index.js"]
mysql:
image: mysql:8
container_name: mysql
restart: always
volumes:
- mysql-volume:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: *******
MYSQL_DATABASE: *******
networks:
- web
command: --default-authentication-plugin=mysql_native_password
FROM ghost:4
RUN apt-get update -y && \
apt-get install -y mariadb-client
COPY ./wait-for-mysql.sh /usr/local/bin/wait-for-mysql.sh
#!/bin/bash
set -e
host="$1"
shift
cmd="$@"
until mysql -hmysql -p"3306" -u"${database__connection__user}" -p"${database__connection__password}" \
-D"${database__connection__database}" ; do
>&2 echo "MySQL is unavailable - sleeping"
sleep 1
done
>&2 echo "MySQL is up - executing command"
exec "$@"
@nalakawula
Copy link

Nice, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment