You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Migrated to Alpine + Nginx + php-fpm. This allowed to reduce memory usage from ~300MB to ~40MB!
8
+
* Changed versioning convention from `cpXXX-revYYY` to `CLASSICPRESS_VERSION-rRELEASE_NUMBER`
9
+
* Migrated from `APACHE_RUN_USER_ID` and `APACHE_RUN_GROUP_ID` to shared between host and container group `press(gid=2048)`.
10
+
*`wp-config.template.php` now contains `define('WP_AUTO_UPDATE_CORE', false);` which should stop CP from auto-updating (this is added only to new installations, so it may be that you must add it manually to your config)
Copy file name to clipboardExpand all lines: README.md
+21-28Lines changed: 21 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,25 @@ Quote from [www.classicpress.net](https://www.classicpress.net/):
4
4
5
5
> 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.
Tagging convention is: `CLASIC_PRESS_VERSION-rRELEASE`
16
+
17
+
`CLASIC_PRESS_VERSION` is ClassicPress version, `RELEASE` is Docker Image release number. Eg. `1.7.1-r1`.
11
18
12
-
`XXX` is ClassicPress version. `YYY` is Docker Image revision number.
13
19
## Basic Information
14
20
15
-
* The image is based on [`php:7.4-apache-bullseye`](https://hub.docker.com/_/php?tab=tags&name=7.4-apache-bullseye)
21
+
* 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)
22
+
* Some code taken from [`TrafeX/docker-php-nginx:2.5.0`](https://github.com/TrafeX/docker-php-nginx) which I highly recommend! Unfortunatelly I coudln't use it (inherit) because Docker has no mechanism to "unexpose" port and remove health check
23
+
* Thanks to Alpine + Nginx + php-fpm, the image is using only around ~40MB of RAM
16
24
* Has enabled all required and recommended php extensions for WordPress
17
-
*Has installed [`apache2-mod-security2`](https://github.com/SpiderLabs/ModSecurity) with [enabled OWASP CSR](https://owasp.org/www-project-modsecurity-core-rule-set/)
25
+
*Basic security hardening done
18
26
* Support for Docker Secrets via env variables with `_FILE` suffix
19
27
20
28
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](https://doc.traefik.io/traefik/) or [Nginx Proxy Manager](https://nginxproxymanager.com/).
Good Docker practice is that one service/server == one docker container, this is why you will still need to run separate container
29
37
with a database (MySQL/MariaDB).
30
38
31
-
### Privilages
32
-
33
-
Apache server inside is using two environment variables to set privilages:
34
-
35
-
*`APACHE_RUN_USER_ID`
36
-
*`APACHE_RUN_GROUP_ID`
37
-
38
-
By default Docker runs everything with _root_ privilages. There are many great articles describing the impications of this solution, like:
39
+
### Write Permission
39
40
40
-
*[File Permissions: the painful side of Docker](https://blog.gougousis.net/file-permissions-the-painful-side-of-docker/)
41
-
*[Permission problems in bind mount in Docker Volume](https://techflare.blog/permission-problems-in-bind-mount-in-docker-volume/)
42
-
*[File permissions on Docker volumes](https://ikriv.com/blog/?p=4698)
41
+
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.
43
42
44
-
This is why this image is running the Apache server as `apache:apache`.
45
-
The trick here is, that Apache's user ID (`APACHE_RUN_USER_ID`) and group ID (`APACHE_RUN_GROUP_ID`) are set on fly, to user ID and group ID of the docker container runner. Only downside of this solution is that
46
-
you need to set `UID` and `GID` env variables (for example in `~/.bashrc`) like this:
43
+
If you are running Debian/Ubuntu-based run on your host machine:
47
44
48
45
```sh
49
-
export UID=$(id -u)
50
-
export GID=$(id -g)
46
+
sudo groupadd -g 2048 press
47
+
sudo usermod $(whoami) -aG press
51
48
```
52
49
53
-
With this, you can use it in Docker Compose like this:
50
+
Read more:
54
51
55
-
```yaml
56
-
environment:
57
-
- "APACHE_RUN_USER_ID=${UID}"
58
-
- "APACHE_RUN_GROUP_ID=${GID}"
59
-
```
52
+
*[File Permissions: the painful side of Docker](https://blog.gougousis.net/file-permissions-the-painful-side-of-docker/)
53
+
*[Permission problems in bind mount in Docker Volume](https://techflare.blog/permission-problems-in-bind-mount-in-docker-volume/)
54
+
*[File permissions on Docker volumes](https://ikriv.com/blog/?p=4698)
60
55
61
56
### With Docker Compose
62
57
@@ -105,8 +100,6 @@ docker-compose -f docker-compose.example.yaml --env-file=myblog-env-example up
0 commit comments