├── .gitignore ├── .dockerignore ├── php ├── php-cli.ini ├── conf.d │ └── opcache.ini └── php.ini ├── .actrc ├── .github ├── dependabot.yml └── workflows │ └── deploy-docker-image.yml ├── apache2 ├── conf.d │ └── mpm.conf └── httpd.conf ├── docker-compose.build.yml ├── docker-compose.yml ├── phpbb └── config.php ├── update.sh ├── start.sh ├── LICENSE ├── Dockerfile └── README.MD /.gitignore: -------------------------------------------------------------------------------- 1 | .secrets -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .secrets 2 | .act -------------------------------------------------------------------------------- /php/php-cli.ini: -------------------------------------------------------------------------------- 1 | [php] 2 | memory_limit = -1 3 | -------------------------------------------------------------------------------- /.actrc: -------------------------------------------------------------------------------- 1 | -P ubuntu-latest=catthehacker/ubuntu:act-latest 2 | --secret-file .secrets -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /php/conf.d/opcache.ini: -------------------------------------------------------------------------------- 1 | opcache.memory_consumption=64 2 | opcache.interned_strings_buffer=8 3 | opcache.max_accelerated_files=4000 4 | opcache.validate_timestamps=0 5 | opcache.revalidate_freq=0 6 | opcache.fast_shutdown=1 7 | opcache.enable_cli=1 8 | opcache.file_cache=/phpbb/opcache -------------------------------------------------------------------------------- /apache2/conf.d/mpm.conf: -------------------------------------------------------------------------------- 1 | PidFile "/run/apache2/httpd.pid" 2 | 3 | 4 | StartServers 5 5 | MinSpareServers 5 6 | MaxSpareServers 10 7 | MaxRequestWorkers 250 8 | MaxConnectionsPerChild 0 9 | -------------------------------------------------------------------------------- /php/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | file_uploads = On 3 | max_file_uploads = 2 4 | upload_max_filesize = 8M 5 | post_max_size = 8M 6 | 7 | allow_url_fopen = On 8 | 9 | expose_php = Off 10 | security.limit_extensions = .php 11 | 12 | output_buffering = On 13 | display_errors = Off 14 | log_errors = On 15 | error_log = /dev/stderr 16 | 17 | [Date] 18 | date.timezone = 'UTC' -------------------------------------------------------------------------------- /docker-compose.build.yml: -------------------------------------------------------------------------------- 1 | volumes: 2 | phpbb-sqlite: {} 3 | phpbb-files: {} 4 | phpbb-store: {} 5 | phpbb-avatars: {} 6 | 7 | services: 8 | phpbb: 9 | build: . 10 | ports: 11 | - '127.0.0.1:8000:80' 12 | volumes: 13 | - 'phpbb-sqlite:/phpbb/sqlite' 14 | - 'phpbb-files:/phpbb/www/files' 15 | - 'phpbb-store:/phpbb/www/store' 16 | - 'phpbb-avatars:/phpbb/www/images/avatars/upload' 17 | environment: 18 | PHPBB_INSTALL: 'true' -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | volumes: 2 | phpbb-sqlite: {} 3 | phpbb-files: {} 4 | phpbb-store: {} 5 | phpbb-avatars: {} 6 | 7 | services: 8 | phpbb: 9 | image: selim13/phpbb:3.3 10 | ports: 11 | - '127.0.0.1:8000:80' 12 | volumes: 13 | - 'phpbb-sqlite:/phpbb/sqlite' 14 | - 'phpbb-files:/phpbb/www/files' 15 | - 'phpbb-store:/phpbb/www/store' 16 | - 'phpbb-avatars:/phpbb/www/images/avatars/upload' 17 | environment: 18 | #PHPBB_INSTALL: 'true' 19 | PHPBB_DB_AUTOMIGRATE: 'true' 20 | -------------------------------------------------------------------------------- /phpbb/config.php: -------------------------------------------------------------------------------- 1 | 82 | #LoadModule cgid_module modules/mod_cgid.so 83 | 84 | 85 | #LoadModule cgi_module modules/mod_cgi.so 86 | 87 | #LoadModule vhost_alias_module modules/mod_vhost_alias.so 88 | #LoadModule negotiation_module modules/mod_negotiation.so 89 | LoadModule dir_module modules/mod_dir.so 90 | #LoadModule actions_module modules/mod_actions.so 91 | #LoadModule speling_module modules/mod_speling.so 92 | #LoadModule userdir_module modules/mod_userdir.so 93 | LoadModule alias_module modules/mod_alias.so 94 | LoadModule rewrite_module modules/mod_rewrite.so 95 | 96 | LoadModule negotiation_module modules/mod_negotiation.so 97 | 98 | 99 | User apache 100 | Group apache 101 | 102 | 103 | 104 | ServerAdmin you@example.com 105 | 106 | ServerSignature Off 107 | 108 | #ServerName www.example.com:80 109 | 110 | 111 | AllowOverride none 112 | Require all denied 113 | 114 | 115 | DocumentRoot "/phpbb/www" 116 | 117 | Options FollowSymLinks 118 | AllowOverride All 119 | Require all granted 120 | 121 | # Return 404 for all dot files (.htaccess, .git, etc...) 122 | RedirectMatch 404 /\..*$ 123 | 124 | 125 | 126 | DirectoryIndex index.php index.html 127 | 128 | 129 | 130 | Require all denied 131 | 132 | 133 | ErrorLog /dev/stderr 134 | LogLevel warn 135 | 136 | 137 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 138 | LogFormat "%h %l %u %t \"%r\" %>s %b" common 139 | 140 | CustomLog /dev/stdout combined 141 | 142 | 143 | 144 | 145 | TypesConfig /etc/apache2/mime.types 146 | AddType application/x-compress .Z 147 | AddType application/x-gzip .gz .tgz 148 | 149 | 150 | 151 | 152 | MIMEMagicFile /etc/apache2/magic 153 | 154 | 155 | IncludeOptional /etc/apache2/conf.d/*.conf 156 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # phpBB3 docker image 2 | 3 | Lightweight, Alpine based [phpBB](https://www.phpbb.com/) docker image. 4 | 5 | # Supported tags and respective `Dockerfile` links 6 | 7 | - [`3.3`, `3.3.4`, `latest`](https://github.com/selim13/docker-phpbb/blob/master/Dockerfile) bundled with PHP 8 8 | - [`3.2`, `3.2.11`](https://github.com/selim13/docker-phpbb/blob/3.2-alpine-apache/Dockerfile) bundled with PHP 7.2 9 | 10 | # How to use this image 11 | 12 | ## Initial installation 13 | 14 | If you don't have a prepared phpBB database, you can use a standard phpBB 15 | installer script, just run a temporary container with `PHPBB_INSTALL=true` 16 | environment variable: 17 | 18 | ```console 19 | $ docker run -p 8000:80 --name phpbb-install -e PHPBB_INSTALL=true -d selim13/phpbb:3.3 20 | ``` 21 | 22 | Point your browser to the http://localhost:8000 to begin the 23 | installation process. 24 | 25 | This image is bundled with SQLite3, MySQL and PostgresSQL database engines 26 | support. Others can be added by creating custom Dockerfile. For MySQL and PostgresSQL 27 | you can use standard container linking or use SQLite if you want a self 28 | sufficient container. 29 | 30 | For SQLite3 set `Database server hostname or DSN` field to `/phpbb/sqlite/sqlite.db`. 31 | This file will be created on a docker volume and outside of the webserver's document root 32 | for security. Leave user name, password and database name fields blank. 33 | 34 | After the installation process is complete you can safely stop this container: 35 | 36 | ```console 37 | $ docker stop phpbb-install 38 | ``` 39 | 40 | ## Starting 41 | 42 | You can start a container as follows: 43 | 44 | 45 | ```console 46 | $ docker run --name phpbb -d selim13/phpbb:3.3 47 | ``` 48 | 49 | By default, it uses SQLite3 as a database backend, so you will need to supply 50 | it with a database file. It's default path is `/phpbb/sqlite/sqlite.db`. 51 | 52 | You can import it from the temporary installation container above: 53 | 54 | ```console 55 | $ docker run --volumes-from phpbb-install --name phpbb -d selim13/phpbb:3.3 56 | ``` 57 | 58 | Or just copy it inside container if you have one from previous phpBB 59 | installations: 60 | 61 | ```console 62 | $ docker cp /path/at/host/sqlite.db phpbb:/www/sqlite/sqlite.db 63 | ``` 64 | 65 | For other database engines you will need to pass credentials and driver type 66 | using environment variables: 67 | 68 | ```console 69 | $ docker run --name phpbb \ 70 | -e PHPBB_DB_DRIVER=mysqli \ 71 | -e PHPBB_DB_HOST=dbmysql \ 72 | -e PHPBB_DB_PORT=3306 \ 73 | -e PHPBB_DB_NAME=phpbb \ 74 | -e PHPBB_DB_USER=phpbb \ 75 | -e PHPBB_DB_PASSWD=pass -d selim13/phpbb:3.3 76 | ``` 77 | 78 | ## Environment variables 79 | 80 | This image utilises environment variables for basic configuration. Most of 81 | them are passed directly to phpBB's `config.php` or to the startup script. 82 | 83 | ### PHPBB_INSTALL 84 | If set to `true`, container will start with an empty `config.php` file and 85 | phpBB `/install/` directory intact. This will allow you to initilalize 86 | a forum database upon fresh installation. 87 | 88 | ### PHPBB_DB_DRIVER 89 | 90 | Selects a database driver. phpBB3 ships with following drivers: 91 | - `mssql` - MS SQL Server 92 | - `mysql` - MySQL via outdated php extension 93 | - `mysqli` - MySQL via newer php extension 94 | - `oracle` - Oracle 95 | - `postgres` - PostgreSQL 96 | - `sqlite` - SQLite 2 97 | - `sqlite3` - SQLite 3 98 | 99 | This image is bundled with support of `sqlite3`, `mysqli` and `postgres` drivers. 100 | 101 | Default value: sqlite3 102 | 103 | ### PHPBB_DB_HOST 104 | 105 | Database hostname or ip address. 106 | 107 | For the SQLite3 driver sets database file path. 108 | 109 | Default value: /phpbb/sqlite/sqlite.db 110 | 111 | ### PHPBB_DB_PORT 112 | 113 | Database port. 114 | 115 | ### PHPBB_DB_NAME 116 | 117 | Supplies database name for phpBB3. 118 | 119 | ### PHPBB_DB_USER 120 | 121 | Supplies a user name for phpBB3 database. 122 | 123 | ### PHPBB_DB_PASSWD 124 | 125 | Supplies a user password for phpBB3 database. 126 | 127 | If you feel paranoid about providing your database password in an environment 128 | variable, you can always ship it with a custom `config.php` file using volumes 129 | or by extending this image. 130 | 131 | ### PHPBB_DB_TABLE_PREFIX 132 | 133 | Table prefix for phpBB3 database. 134 | 135 | Default value: phpbb_ 136 | 137 | ### PHPBB_DB_AUTOMIGRATE 138 | 139 | If set to `true`, instructs a container to run database migrations by 140 | executing `bin/phpbbcli.php db:migrate` on every startup. 141 | 142 | If migrations fail, container will refuse to start. 143 | 144 | ### PHPBB_DB_WAIT 145 | If set to `true`, container will wait for database service to become available. 146 | You will need to explicitly set `PHPBB_DB_HOST` and `PHPBB_DB_PORT` for this 147 | to work. 148 | 149 | Use in conjunction with `PHPBB_DB_AUTOMIGRATE` to prevent running migrations 150 | before database is ready. 151 | 152 | Won't work for SQLite database engine as it is always available. 153 | 154 | ### PHPBB_DISPLAY_LOAD_TIME 155 | 156 | If set to `true`, phpBB will display page loading time, queries count and peak memory 157 | usage at the bottom of the page. 158 | 159 | ### PHPBB_DEBUG 160 | 161 | If set to `true`, enables phpBB debug mode. 162 | 163 | ### PHPBB_DEBUG_CONTAINER 164 | 165 | ## Volumes 166 | 167 | By default there are four volumes created for each container: 168 | - /phpbb/sqlite 169 | - /phpbb/www/files 170 | - /phpbb/www/store 171 | - /phpbb/www/images/avatars/upload 172 | 173 | # Additional configuration 174 | 175 | This image is based on a stock official Alpine image with apache2 and php5 176 | packages from the Alpine Linux repository, so you can drop their custom 177 | configuration files to `/etc/apache2/conf.d` and `/etc/php5/conf.d`. 178 | 179 | ## Pass user's IP from proxy 180 | 181 | If you are planning to start a container behind proxy 182 | (like [nginx-proxy](https://github.com/jwilder/nginx-proxy)), it will probably 183 | be a good idea to get user's real IP instead of proxy one. For this, you can use 184 | Apache RemoteIP module. Create a configuration file: 185 | 186 | ```apache 187 | LoadModule remoteip_module modules/mod_remoteip.so 188 | 189 | RemoteIPHeader X-Real-IP 190 | RemoteIPInternalProxy nginx-proxy 191 | ``` 192 | 193 | Here `X-Real-IP` is a header name, where proxy passed user's real IP and 194 | `nginx-proxy` is proxy host name. 195 | 196 | Then push it to `/etc/apache2/conf.d/` directory, for example, by extending this 197 | image: 198 | 199 | ```dockerfile 200 | FROM selim13/phpbb:3.3 201 | 202 | COPY remoteip.conf /etc/apache2/conf.d 203 | ``` --------------------------------------------------------------------------------