├── .github └── workflows │ └── dockerimage.yml ├── Dockerfile ├── LICENSE.md ├── README.md └── docker-entrypoint.sh /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | schedule: 5 | - cron: "20 19 * * *" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | env: 11 | BUILD_VERSION: 1822 12 | BUILD_SHA1SUM: c84341b409672d3617300a0348fc81ff21453433 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Build the Docker image 17 | run: | 18 | docker build \ 19 | --build-arg BUILD_AUTHORS="Kane 'kawaii' Valentine " \ 20 | --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ 21 | --build-arg BUILD_SHA1SUM=$BUILD_SHA1SUM \ 22 | --build-arg BUILD_VERSION=$BUILD_VERSION \ 23 | --tag mybb/mybb:$BUILD_VERSION \ 24 | --tag mybb/mybb:latest \ 25 | $PWD 26 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.4-fpm-alpine 2 | 3 | ARG BUILD_AUTHORS 4 | ARG BUILD_DATE 5 | ARG BUILD_SHA512SUM 6 | ARG BUILD_VERSION 7 | 8 | LABEL org.opencontainers.image.authors=$BUILD_AUTHORS \ 9 | org.opencontainers.image.created=$BUILD_DATE \ 10 | org.opencontainers.image.version=$BUILD_VERSION 11 | 12 | RUN set -ex; \ 13 | \ 14 | apk add --no-cache --virtual .build-deps \ 15 | $PHPIZE_DEPS \ 16 | libmemcached-dev \ 17 | freetype-dev \ 18 | libjpeg-turbo-dev \ 19 | libpng-dev \ 20 | libwebp-dev \ 21 | postgresql-dev \ 22 | ; \ 23 | \ 24 | docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \ 25 | docker-php-ext-install -j "$(nproc)" \ 26 | gd \ 27 | mysqli \ 28 | opcache \ 29 | pdo_mysql \ 30 | pdo_pgsql \ 31 | pgsql \ 32 | ; \ 33 | pecl channel-update pecl.php.net; \ 34 | pecl install igbinary-3.2.7 memcached-3.1.5 redis-5.3.7; \ 35 | docker-php-ext-enable igbinary memcached redis; \ 36 | \ 37 | runDeps="$( \ 38 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 39 | | tr ',' '\n' \ 40 | | sort -u \ 41 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 42 | )"; \ 43 | apk add --virtual .mybb-phpexts-rundeps $runDeps; \ 44 | apk del .build-deps 45 | 46 | RUN { \ 47 | echo 'opcache.memory_consumption=128'; \ 48 | echo 'opcache.interned_strings_buffer=8'; \ 49 | echo 'opcache.max_accelerated_files=4000'; \ 50 | echo 'opcache.revalidate_freq=2'; \ 51 | echo 'opcache.fast_shutdown=1'; \ 52 | echo 'opcache.enable_cli=1'; \ 53 | } > /usr/local/etc/php/conf.d/opcache-recommended.ini 54 | 55 | RUN { \ 56 | echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ 57 | echo 'display_errors = Off'; \ 58 | echo 'display_startup_errors = Off'; \ 59 | echo 'log_errors = On'; \ 60 | echo 'error_log = /dev/stderr'; \ 61 | echo 'log_errors_max_len = 1024'; \ 62 | echo 'ignore_repeated_errors = On'; \ 63 | echo 'ignore_repeated_source = Off'; \ 64 | echo 'html_errors = Off'; \ 65 | } > /usr/local/etc/php/conf.d/error-logging.ini 66 | 67 | RUN { \ 68 | echo 'file_uploads=On'; \ 69 | echo 'upload_max_filesize=10M'; \ 70 | echo 'post_max_size=10M'; \ 71 | echo 'max_execution_time=20'; \ 72 | echo 'memory_limit=256M'; \ 73 | } > /usr/local/etc/php/conf.d/mybb-recommended.ini 74 | 75 | ENV MYBB_VERSION $BUILD_VERSION 76 | ENV MYBB_SHA512 $BUILD_SHA512SUM 77 | 78 | RUN set -ex; \ 79 | curl -o mybb.tar.gz -fSL "https://github.com/mybb/mybb/archive/refs/tags/mybb_${MYBB_VERSION}.tar.gz"; \ 80 | echo "$MYBB_SHA512 *mybb.tar.gz" | sha512sum -c -; \ 81 | tar -xzf mybb.tar.gz -C /usr/src/; \ 82 | rm mybb.tar.gz; \ 83 | chown -R www-data:www-data /usr/src/mybb-mybb_${MYBB_VERSION} 84 | 85 | COPY docker-entrypoint.sh /usr/local/bin/ 86 | 87 | ENTRYPOINT ["docker-entrypoint.sh"] 88 | CMD ["php-fpm"] 89 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, MyBB Forum Software 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Docker Pulls](https://img.shields.io/docker/pulls/mybb/mybb.svg) ![Docker Stars](https://img.shields.io/docker/stars/mybb/mybb.svg) 2 | # Supported tags and respective `Dockerfile` links 3 | 4 | - [`latest`, `1.8`, `1.8.30` (*Dockerfile*)](https://github.com/mybb/docker/blob/master/Dockerfile) 5 | 6 | # Quick reference 7 | 8 | - **Where to get help**: 9 | [the MyBB Community Forums](https://community.mybb.com/) 10 | 11 | - **Where to file issues**: 12 | [https://github.com/mybb/docker/issues](https://github.com/mybb/docker/issues) 13 | 14 | - **Maintained by**: 15 | [the MyBB Team](https://mybb.com/about/team/) 16 | 17 | # What is MyBB? 18 | 19 | MyBB is the free and open source, intuitive, extensible, and incredibly powerful forum software you've been looking for. With everything from forums to threads, posts to private messages, search to profiles, and reputation to warnings, MyBB features everything you need to run an efficient and captivating community. Through plugins and themes, you can extend MyBB's functionality to build your community exactly as you'd like it. Learn more at [MyBB.com](https://mybb.com). 20 | 21 | > [wikipedia.org/wiki/MyBB](https://en.wikipedia.org/wiki/MyBB) 22 | 23 | ![logo](https://mybb.com/assets/images/logo.png) 24 | 25 | # How to use this image 26 | 27 | ## ... via [`docker stack deploy`](https://docs.docker.com/engine/reference/commandline/stack_deploy/) or [`docker-compose`](https://github.com/docker/compose) 28 | 29 | Example `stack.yml` for `mybb`: 30 | 31 | ```yaml 32 | services: 33 | mybb: 34 | image: mybb/mybb:latest 35 | volumes: 36 | - ${PWD}/mybb:/var/www/html:rw 37 | 38 | nginx: 39 | image: nginx:mainline-alpine 40 | ports: 41 | - published: 8080 42 | target: 80 43 | volumes: 44 | - ${PWD}/nginx:/etc/nginx/conf.d:ro 45 | - ${PWD}/mybb:/var/www/html:ro 46 | 47 | postgresql: 48 | environment: 49 | POSTGRES_DB: mybb 50 | POSTGRES_PASSWORD: changeme 51 | POSTGRES_USER: mybb 52 | image: postgres:14-alpine 53 | volumes: 54 | - ${PWD}/postgres/data:/var/lib/postgresql/data:rw 55 | 56 | version: '3.8' 57 | ``` 58 | 59 | Note, you'll also need a virtual host configuration file for the provided `nginx` container. You can find a very basic example [here](https://gist.github.com/kawaii/ed2fbbf11309b8f635a623fa87abce8d). Create this file as `nginx/default.conf`, respective to the location of your `docker-compose.yml` file. 60 | 61 | You should note that static content such as images and JavaScript or CSS files must be cross-mounted between the `mybb` and `nginx` containers - as PHP-FPM is not capable of serving those natively. 62 | 63 | # Preserving existing files 64 | 65 | If you wish to run this image and preserve any updated `lang` or `config` files, you can add the following flag: 66 | 67 | ``` 68 | docker run mybb/mybb --skip-old-files php-fpm 69 | ``` 70 | 71 | or, within your compose file, specify the following command argument: 72 | 73 | ```yaml 74 | services: 75 | mybb: 76 | image: mybb/mybb:latest 77 | command: --skip-old-files php-fpm 78 | volumes: 79 | - ${PWD}/mybb:/var/www/html:rw 80 | 81 | ... 82 | ``` 83 | 84 | # How to build this image 85 | 86 | You must provide four build-time arguments when building this Docker image; `BUILD_AUTHORS`, `BUILD_DATE`, `BUILD_SHA512SUM` and `BUILD_VERSION`. 87 | ``` 88 | docker build \ 89 | --build-arg BUILD_AUTHORS="Kane 'kawaii' Valentine " \ 90 | --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ 91 | --build-arg BUILD_SHA512SUM=be3bdec9617050abbabbfcfa40e9cd145db3a57ae70e740bc62d807b04c08a5fa42ac690a5502c344f0f7452276aa0f3802501e6d62fa76edc64ac36da25b3cd \ 92 | --build-arg BUILD_VERSION=1830 \ 93 | --tag mybb/mybb:1.8 \ 94 | --tag mybb/mybb:1.8.30 \ 95 | --tag mybb/mybb:latest \ 96 | $PWD 97 | ``` 98 | The resulting image can then be pushed to the [`mybb/mybb`](https://cloud.docker.com/u/mybb/repository/docker/mybb/mybb) Docker Hub repository: 99 | ``` 100 | docker push mybb/mybb:1.8.30 101 | ``` 102 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -euo pipefail 3 | 4 | SKIP_OLD_FILES=false 5 | 6 | # Loop through arguments and process them 7 | for arg in "$@"; do 8 | case $arg in 9 | --skip-old-files) 10 | SKIP_OLD_FILES=true 11 | shift # Remove --skip-verification from `$@` 12 | ;; 13 | *) 14 | break 15 | ;; 16 | esac 17 | done 18 | 19 | if ! [ -e index.php -a -e inc/class_core.php ]; then 20 | echo >&2 "MyBB not found in $PWD - copying now..." 21 | if [[ $SKIP_OLD_FILES == true ]]; then 22 | echo >&2 "Preserving existing directory files..." 23 | tar cf - --one-file-system -C /usr/src/mybb-mybb_${MYBB_VERSION} . | tar xf - --skip-old-files 24 | else 25 | if [ "$(ls -A)" ]; then 26 | echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" 27 | ( set -x; ls -A; sleep 10 ) 28 | fi 29 | tar cf - --one-file-system -C /usr/src/mybb-mybb_${MYBB_VERSION} . | tar xf - 30 | fi 31 | echo >&2 "Complete! MyBB ${MYBB_VERSION} has been successfully copied to $PWD" 32 | fi 33 | 34 | exec "$@" 35 | --------------------------------------------------------------------------------