I needed a local instance to play around with phpBB, which I couldn’t find recent docker files for, so I just created my own. The below are the docker-compose.yml and Dockerfile for the latest version of phpBB as of now; 3.3.14.
Note: Make sure to change the variables inside the environment section in the docker-compose.yml file before installation.
Dockerfile
# Use the official PHP image with Apache
FROM php:8.2-apache
# Install required PHP extensions and dependencies
RUN apt-get update && apt-get install -y \
wget \
mariadb-client \
unzip \
&& docker-php-ext-install mysqli pdo pdo_mysql \
&& docker-php-ext-enable mysqli pdo pdo_mysql \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Enable Apache modules
RUN a2enmod rewrite
# Set working directory
WORKDIR /var/www/html
# Download and extract phpBB
RUN wget https://download.phpbb.com/pub/release/3.3/3.3.14/phpBB-3.3.14.zip && \
unzip phpBB-3.3.14.zip && \
mv phpBB3 phpbb && \
rm -rf phpBB-3.3.14.zip
# Set permissions
RUN chown -R www-data:www-data /var/www/html/phpbb && \
chmod -R 755 /var/www/html/phpbb
# Expose Apache port
EXPOSE 80
CMD ["apache2-foreground"]
docker-compose.yml
services:
phpbb:
build: .
container_name: phpbb
restart: unless-stopped
ports:
- "8080:80"
volumes:
- phpbb-data:/var/www/html/phpbb
depends_on:
- mariadb
environment:
- MYSQL_HOST=mymariadb_host
- MYSQL_USER=myphpbb_mymariadb_user
- MYSQL_PASSWORD=MySuperStrongPassword12345
- MYSQL_DATABASE=myphpbb_db
mariadb:
image: mariadb:10.11
container_name: phpbb-mariadb
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: myphpbb_db
MYSQL_USER: myphpbb_mymariadb_user
MYSQL_PASSWORD: MySuperStrongPassword12345
volumes:
- db-data:/var/lib/mysql
volumes:
phpbb-data:
db-data:
Let’s get to action!
- To build and start:
docker-compose up -d --build
- Access the installation at
http://localhost:8080/phpbb/install and enter the parameters inside the first environment section in the docker-compose.yml file
- After installation is complete from the above link, you have to run
docker exec -it phpbb rm -rf /var/www/html/phpbb/install
- To wipe it and start all over:
docker-compose down -v
I’ve made these file also available on my GitHub repo here: https://github.com/ahmedatawfik/usefulscripts/tree/main/docker/phpBB
That’s it, Enjoy!
References: