/classicpress-docker

ClassicPress in Docker Image

Primary LanguageDockerfileApache License 2.0Apache-2.0

ClassicPress in Docker Image

Quote from www.classicpress.net:

ClassicPress is a community-led open source content management system and a fork of WordPress that preserves the TinyMCE classic editor as the default option.

Changelog

Open changelog

Tags

Convention

Tagging convention is: CLASIC_PRESS_VERSION-rRELEASE

CLASIC_PRESS_VERSION is ClassicPress version, RELEASE is Docker Image release number. Eg. 1.7.1-r1.

Basic Information

  • The image is based on Alpine 3.16 and php 8.0 (3.16 is a bit old, but it's last version having php8.0 which is required by ClassicPress 1.x)
  • Some code taken from TrafeX/docker-php-nginx:2.5.0 which I highly recommend! Unfortunatelly I coudln't use it (inherit) because Docker has no mechanism to "unexpose" port and remove health check
  • Thanks to Alpine + Nginx + php-fpm, the image is using only around ~40MB of RAM
  • Has enabled all required and recommended php extensions for WordPress
  • Basic security hardening done
  • Support for Docker Secrets via env variables with _FILE suffix

Note: Even with basic hardening done, it's highly recommended to not to expose a container directly to the outside world. Consider using a reverse proxy like traefik or Nginx Proxy Manager.

Current

https://hub.docker.com/r/marverix/classicpress/tags

Usage

Good Docker practice is that one service/server == one docker container, this is why you will still need to run separate container with a database (MySQL/MariaDB).

Write Permission

This image deals with write access shared between host and the container by group press (and user) with ID 2048. This is why your user running the container must be in this group.

If you are running Debian/Ubuntu-based run on your host machine:

sudo groupadd -g 2048 press
sudo usermod $(whoami) -aG press

Read more:

With Docker Compose

You will need to create own docker-compose.yaml file. As a start point, you can use docker-compose.example.yaml and myblog-env-example. Then simply run:

docker-compose -f docker-compose.example.yaml --env-file=myblog-env-example up

Manually

  1. Create network

    docker network create --driver bridge classicpress_network
  2. Set up MariaDB/MySQL:

    docker volume create mariadb_data
    docker run \
        --detach \
        --name mariadb \
        --volume mariadb_data:/var/lib/mysql \
        --env MARIADB_DATABASE=myblog_db \
        --env MARIADB_USER=myblog_user \
        --env MARIADB_PASSWORD=my_secret_passowrd \
        --env MARIADB_ROOT_PASSWORD=my_turbo_secret_password \
        --restart=unless-stopped \
        mariadb:10.7.3
  3. Create a volume where will be stored config and data.

    docker volume create myblog_data
  4. Run

    docker run \
        --detach \
        --expose 80:80 \
        --name myblog \
        --volume myblog_data:/data \
        --env CP_DB_NAME=myblog_db \
        --env CP_DB_USER=myblog_user \
        --env CP_DB_PASSWORD=my_secret_passowrd \
        --env CP_DB_HOST=mariadb \
        --restart=unless-stopped \
        marverix/classicpress:latest

Development

How-to is described in a separate document.