Skip to content

Instantly share code, notes, and snippets.

@ZachWatkins
Last active November 4, 2022 15:13
Show Gist options
  • Save ZachWatkins/67188cc5e0d4dcb38d1bf52b44e21b04 to your computer and use it in GitHub Desktop.
Save ZachWatkins/67188cc5e0d4dcb38d1bf52b44e21b04 to your computer and use it in GitHub Desktop.
WordPress Docker setup for NGINX
/secrets
/persist
version: "2"
services:
mariadb:
image: docker.io/bitnami/mariadb:10.6
volumes:
- /persist/db:/bitnami/mariadb
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_wordpress
- MARIADB_DATABASE=bitnami_wordpress
wordpress:
image: docker.io/bitnami/wordpress-nginx:6
ports:
- "80:8080"
- "443:8443"
volumes:
- /persist/wordpress:/bitnami/wordpress
depends_on:
- mariadb
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- WORDPRESS_DATABASE_HOST=mariadb
- WORDPRESS_DATABASE_PORT_NUMBER=3306
- WORDPRESS_DATABASE_USER=bn_wordpress
- WORDPRESS_DATABASE_NAME=bitnami_wordpress
#!/bin/bash
# Make Docker secrets from WordPress salts API.
salts=$(curl https://api.wordpress.org/secret-key/1.1/salt/)
while IFS= read -r line; do
key=${line:8:18}
key=${key/"',"/}
key=$(echo ${key/ */} | tr '[:upper:]' '[:lower:]')
value=${line:28:-3}
echo "$value" > secrets/$key
done <<< "$salts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment