A clone of the official wordpress image with a few modifications
4.6K
This is a clone of the official wordpress apache-image with a few modifications. First of all the VOLUME declaration is removed from the image, it's better to leave that decision to the site maintainer what to expose as volumes. All entry points are removed, we rely on you to do that or to leave it to the base image to start apache. Also all WP files are placed in /var/www/html by default. Core files are part of the app/image and we don't want an entrypoint to copy the files.
All these modifications are more or less related to the removal of the VOLUME declaration.
WP-core files (the app) is not owned by www-data by default anymore. There's instead two arguments ("user" and "uid") where you can change this at build time. This is done to deny WP from changing itself which is a major security thing with WP overall. Yes, that also implies that you can't install plugins from the gui anymore, but if you want to do that, use the official image. Install whatever plugins you like in your own Dockerfile.
WP-CLI is bundled with the image. It doesn't affect image size that much and makes it way easier to run tasks on a site without additional images and duplications of DB configs in composer.yaml files etc.
FROM wappo/wordpress:5
WORKDIR /var/www/html
COPY --chown=wordpress:wordpress ./wp-content/mu-plugins wp-content/mu-plugins/
COPY --chown=wordpress:wordpress ./wp-content/languages wp-content/languages/
COPY --chown=wordpress:wordpress ./wp-content/plugins wp-content/plugins/
COPY --chown=wordpress:wordpress ./wp-content/themes wp-content/themes/
version: "3"
services:
wordpress-www:
image: company/wordpress:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.wordpress-www.entrypoints=web"
- "traefik.http.routers.wordpress-www.rule=Host(`wp-test.local`)"
- "traefik.http.services.wordpress-www.loadbalancer.server.port=80"
- "traefik.docker.network=web"
environment:
WORDPRESS_DB_HOST: mariadb
WORDPRESS_DB_USER: www
WORDPRESS_DB_PASSWORD: ""
WORDPRESS_DB_NAME: wordpress_db_name
WORDPRESS_AUTH_KEY: ""
WORDPRESS_SECURE_AUTH_KEY: ""
WORDPRESS_LOGGED_IN_KEY: ""
WORDPRESS_NONCE_KEY: ""
WORDPRESS_AUTH_SALT: ""
WORDPRESS_SECURE_AUTH_SALT: ""
WORDPRESS_LOGGED_IN_SALT: ""
WORDPRESS_NONCE_SALT: ""
WORDPRESS_CONFIG_EXTRA: "define( 'WP_AUTO_UPDATE_CORE', false);define('DISALLOW_FILE_EDIT', true);define('DISALLOW_FILE_MODS',true);define( 'WP_POST_REVISIONS', 5);define('DISABLE_WP_CRON', true);"
networks:
- bridge
volumes:
- wordpress_uploads:/var/www/html/wp-content/uploads
networks:
bridge:
name: 'bridge'
volumes:
wordpress_uploads:
name: 'wordpress_uploads'
FPM needs a webserver to ship static content and since WP mixes static and dynamic content inside the app you really need to expose the entire app in a VOLUME for that to work. Use the official image instead. Yes, one could copy the app into two containers (fpm and nginx) but that's too much hassle for the small performance gain we're talking about. And, it doesn't feel right in the tummy to do it like that either.
Content type
Image
Digest
sha256:22557749f…
Size
351.9 MB
Last updated
3 days ago
docker pull wappo/wordpress:7.1.2-phord8.4