mirror of
https://git.sindominio.net/estibadores/wordpress.git
synced 2024-11-21 18:21:07 +01:00
First steps
This commit is contained in:
commit
bf89bdbe8c
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
FROM registry.sindominio.net/nginx-php
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -qy install --no-install-recommends \
|
||||||
|
gnupg ca-certificates less \
|
||||||
|
php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-redis && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# install wp-cli
|
||||||
|
ADD https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar /usr/local/bin/wp
|
||||||
|
RUN chmod +rx /usr/local/bin/wp
|
||||||
|
|
||||||
|
# verify wp-cli signature
|
||||||
|
COPY wp-key.asc /key.asc
|
||||||
|
ADD https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar.asc /wp.asc
|
||||||
|
RUN gpg --import /key.asc && \
|
||||||
|
gpg --verify /wp.asc /usr/local/bin/wp
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# install wordpress
|
||||||
|
RUN wp --allow-root core download
|
||||||
|
ADD wp-config.php /app/
|
||||||
|
# TODO: install themes and plugins
|
||||||
|
|
||||||
|
VOLUME /app/wp-content/uploads
|
||||||
|
|
||||||
|
ADD setup /etc/setup
|
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# container image of WordPress
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir uploads db
|
||||||
|
$ cp env.sample .env
|
||||||
|
$ vim .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Customize parameters
|
||||||
|
|
||||||
|
## Custom themes or pluggins
|
||||||
|
|
||||||
|
To include custom themes or pluggins mount them directly into /app/wp-content/:
|
||||||
|
```
|
||||||
|
volumes:
|
||||||
|
- ./uploads:/app/wp-content/uploads
|
||||||
|
- ./mytheme:/app/wp-content/themes/mytheme
|
||||||
|
```
|
38
docker-compose.yml
Normal file
38
docker-compose.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
version: '2.4'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
# TODO: fix our mariadb container
|
||||||
|
#image: registry.sindominio.net/mariadb
|
||||||
|
image: mysql
|
||||||
|
user: "$USER_GROUP"
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./db:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_RANDOM_ROOT_PASSWORD=1
|
||||||
|
- MYSQL_DATABASE
|
||||||
|
- MYSQL_USER
|
||||||
|
- MYSQL_PASSWORD
|
||||||
|
|
||||||
|
wordpress:
|
||||||
|
image: registry.sindominio.net/wordpress
|
||||||
|
user: "$USER_GROUP"
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
- ./uploads:/app/wp-content/uploads
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
environment:
|
||||||
|
- MYSQL_HOST=db
|
||||||
|
- MYSQL_DATABASE
|
||||||
|
- MYSQL_USER
|
||||||
|
- MYSQL_PASSWORD
|
||||||
|
- WP_USER
|
||||||
|
- WP_PASS
|
||||||
|
- WP_EMAIL
|
||||||
|
- WP_TITLE
|
||||||
|
- WP_URL
|
||||||
|
|
11
env.sample
Normal file
11
env.sample
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
MYSQL_DATABASE=wordpress
|
||||||
|
MYSQL_USER=wordpress
|
||||||
|
MYSQL_PASSWORD=wordpress
|
||||||
|
|
||||||
|
USER_GROUP=1000:1000
|
||||||
|
|
||||||
|
WP_USER=admin
|
||||||
|
WP_PASS=admin
|
||||||
|
WP_EMAIL=real@mail.org
|
||||||
|
WP_TITLE=Wordpress Title
|
||||||
|
WP_URL=http://docker:8080
|
15
setup
Executable file
15
setup
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export WORDPRESS_ROOT=/app
|
||||||
|
WP_CLI="/usr/local/bin/wp --allow-root --path=$WORDPRESS_ROOT"
|
||||||
|
|
||||||
|
# TODO: wait for the DB to be ready
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
if ! $WP_CLI core is-installed; then
|
||||||
|
echo "Install Wordpress"
|
||||||
|
$WP_CLI core install --url="$WP_URL" --title="$WP_TITLE" --admin_user="$WP_USER" --admin_password="$WP_PASS" --admin_email="$WP_EMAIL"
|
||||||
|
else
|
||||||
|
echo "Update DB"
|
||||||
|
$WP_CLI core update-db
|
||||||
|
fi
|
8
version
Executable file
8
version
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# https://codex.wordpress.org/WordPress.org_API
|
||||||
|
WP=`curl -s https://api.wordpress.org/core/version-check/1.7/ |jq -r '.offers[0].version'`
|
||||||
|
|
||||||
|
WP_CLI=`curl -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar |sha256sum |awk '{ print $1 }'`
|
||||||
|
|
||||||
|
echo "$WP:$WP_CLI"
|
134
wp-config.php
Normal file
134
wp-config.php
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The base configuration for WordPress
|
||||||
|
*
|
||||||
|
* The wp-config.php creation script uses this file during the installation.
|
||||||
|
* You don't have to use the web site, you can copy this file to "wp-config.php"
|
||||||
|
* and fill in the values.
|
||||||
|
*
|
||||||
|
* This file contains the following configurations:
|
||||||
|
*
|
||||||
|
* * Database settings
|
||||||
|
* * Secret keys
|
||||||
|
* * Database table prefix
|
||||||
|
* * ABSPATH
|
||||||
|
*
|
||||||
|
* This has been slightly modified (to read environment variables) for use in Docker.
|
||||||
|
*
|
||||||
|
* @link https://wordpress.org/support/article/editing-wp-config-php/
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
*/
|
||||||
|
|
||||||
|
// IMPORTANT: this file needs to stay in-sync with https://github.com/WordPress/WordPress/blob/master/wp-config-sample.php
|
||||||
|
// (it gets parsed by the upstream wizard in https://github.com/WordPress/WordPress/blob/f27cb65e1ef25d11b535695a660e7282b98eb742/wp-admin/setup-config.php#L356-L392)
|
||||||
|
|
||||||
|
// a helper function to lookup "env_FILE", "env", then fallback
|
||||||
|
if (!function_exists('getenv_docker')) {
|
||||||
|
// https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x)
|
||||||
|
function getenv_docker($env, $default) {
|
||||||
|
if ($fileEnv = getenv($env . '_FILE')) {
|
||||||
|
return rtrim(file_get_contents($fileEnv), "\r\n");
|
||||||
|
}
|
||||||
|
else if (($val = getenv($env)) !== false) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ** Database settings - You can get this info from your web host ** //
|
||||||
|
/** The name of the database for WordPress */
|
||||||
|
define( 'DB_NAME', getenv_docker('MYSQL_DATABASE', 'wordpress') );
|
||||||
|
|
||||||
|
/** Database username */
|
||||||
|
define( 'DB_USER', getenv_docker('MYSQL_USER', 'example username') );
|
||||||
|
|
||||||
|
/** Database password */
|
||||||
|
define( 'DB_PASSWORD', getenv_docker('MYSQL_PASSWORD', 'example password') );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Docker image fallback values above are sourced from the official WordPress installation wizard:
|
||||||
|
* https://github.com/WordPress/WordPress/blob/f9cc35ebad82753e9c86de322ea5c76a9001c7e2/wp-admin/setup-config.php#L216-L230
|
||||||
|
* (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Database hostname */
|
||||||
|
define( 'DB_HOST', getenv_docker('MYSQL_HOST', 'mysql') );
|
||||||
|
|
||||||
|
/** Database charset to use in creating database tables. */
|
||||||
|
define( 'DB_CHARSET', 'utf8');
|
||||||
|
|
||||||
|
/** The database collate type. Don't change this if in doubt. */
|
||||||
|
define( 'DB_COLLATE', '');
|
||||||
|
|
||||||
|
/**#@+
|
||||||
|
* Authentication unique keys and salts.
|
||||||
|
*
|
||||||
|
* Change these to different unique phrases! You can generate these using
|
||||||
|
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
||||||
|
*
|
||||||
|
* You can change these at any point in time to invalidate all existing cookies.
|
||||||
|
* This will force all users to have to log in again.
|
||||||
|
*
|
||||||
|
* @since 2.6.0
|
||||||
|
*/
|
||||||
|
// We use only database stored authentication keys
|
||||||
|
// this might be problematic: https://wordpress.stackexchange.com/a/152905/199287
|
||||||
|
define( 'AUTH_KEY', 'very secret key');
|
||||||
|
define( 'SECURE_AUTH_KEY', 'very secret key');
|
||||||
|
define( 'LOGGED_IN_KEY', 'very secret key');
|
||||||
|
define( 'NONCE_KEY', 'very secret key');
|
||||||
|
define( 'AUTH_SALT', 'very secret key');
|
||||||
|
define( 'SECURE_AUTH_SALT', 'very secret key');
|
||||||
|
define( 'LOGGED_IN_SALT', 'very secret key');
|
||||||
|
define( 'NONCE_SALT', 'very secret key');
|
||||||
|
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress database table prefix.
|
||||||
|
*
|
||||||
|
* You can have multiple installations in one database if you give each
|
||||||
|
* a unique prefix. Only numbers, letters, and underscores please!
|
||||||
|
*/
|
||||||
|
$table_prefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For developers: WordPress debugging mode.
|
||||||
|
*
|
||||||
|
* Change this to true to enable the display of notices during development.
|
||||||
|
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||||
|
* in their development environments.
|
||||||
|
*
|
||||||
|
* For information on other constants that can be used for debugging,
|
||||||
|
* visit the documentation.
|
||||||
|
*
|
||||||
|
* @link https://wordpress.org/support/article/debugging-in-wordpress/
|
||||||
|
*/
|
||||||
|
define( 'WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', '') );
|
||||||
|
|
||||||
|
/* Add any custom values between this line and the "stop editing" line. */
|
||||||
|
|
||||||
|
// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
|
||||||
|
// see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
|
||||||
|
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
|
||||||
|
$_SERVER['HTTPS'] = 'on';
|
||||||
|
}
|
||||||
|
// (we include this by default because reverse proxying is extremely common in container environments)
|
||||||
|
|
||||||
|
if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
|
||||||
|
eval($configExtra);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* That's all, stop editing! Happy publishing. */
|
||||||
|
|
||||||
|
/** Absolute path to the WordPress directory. */
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
define( 'ABSPATH', __DIR__ . '/' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets up WordPress vars and included files. */
|
||||||
|
require_once ABSPATH . 'wp-settings.php';
|
30
wp-key.asc
Normal file
30
wp-key.asc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mQENBFsQEBkBCADfGAhxQ71XaIk31SjD8dNH3uVNtPh/2SIIhYbObMvEG6uoMucP
|
||||||
|
t3jCsnkh/veKBkJ+HJ/XcARGoFYdaCZo5PTORBWOwHmeWPbu7aiAM4v3EKPc8wZP
|
||||||
|
jabtEejwZrRFlSlAu5YL25ldz5KNgvGOBdje9jUi2iovQ4lfjMEuH2sXhmDQPbDW
|
||||||
|
22Fb2xinvmlnyf5kJn9ADiWm6VEnaNvaL96TCC1iUrMJmYI0m29j2sVb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atZC2hjFobedc4dT3nxf5iiH9XsHI5bqp3UEsPlx
|
||||||
|
8LP5ABEBAAGJATYEGAEIACACGwwWIQRjr3qhUGfAVhb93YijoujyJvC8BgUCWxAR
|
||||||
|
IQAKCRCjoujyJvC8BhGMCACkNhkshrOYDRoOwny8m1mI2nSIU0KnjEruaeAXrY2T
|
||||||
|
5VHNfLkTX3wD2HYO97r1CvUNBUWpmTwSicK0Z6TCDp4A9Oi+z5CA/5zBT/iydC6E
|
||||||
|
czNAPUehdLKka9Qs0vrVq22S0dDiA4xXZUvQpoo8VUKlvau9igF98mbd56U89s3L
|
||||||
|
gg7O72A/4x7rhDO0Q+U8SIBJtFmEHIcu6gHkooQW3d7opHKCjbnyqxDQ/iUY3b8o
|
||||||
|
n75TXnDJWbjCFTiTMyVTeyQfK0Us8FbJNXhMMagalRQu/sBH56S7Cg2OLciQB1B2
|
||||||
|
sLbhbfYDXYriI/OGVIPvCEIH6FX4+KiFy7RS+0JthI0R
|
||||||
|
=fQDM
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
Loading…
Reference in New Issue
Block a user