Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ Note, you'll also need a virtual host configuration file for the provided `nginx

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.

# Preserving existing files

If you wish to run this image and preserve any updated `lang` or `config` files, you can add the following flag:

```
docker run mybb/mybb --skip-old-files php-fpm
```

or, within your compose file, specify the following command argument:

```yaml
services:
mybb:
image: mybb/mybb:latest
command: --skip-old-files php-fpm
volumes:
- ${PWD}/mybb:/var/www/html:rw

...
```

# How to build this image

You must provide four build-time arguments when building this Docker image; `BUILD_AUTHORS`, `BUILD_DATE`, `BUILD_SHA1SUM` and `BUILD_VERSION`.
Expand Down
28 changes: 24 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
#!/usr/bin/env sh
set -euo pipefail

SKIP_OLD_FILES=false

# Loop through arguments and process them
for arg in "$@"; do
case $arg in
--skip-old-files)
SKIP_OLD_FILES=true
shift # Remove --skip-verification from `$@`
;;
*)
break
;;
esac
done

if ! [ -e index.php -a -e inc/class_core.php ]; then
echo >&2 "MyBB not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
if [[ $SKIP_OLD_FILES == true ]]; then
echo >&2 "Preserving existing directory files..."
tar cf - --one-file-system -C /usr/src/mybb-mybb_${MYBB_VERSION} . | tar xf - --skip-old-files
else
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/mybb-mybb_${MYBB_VERSION} . | tar xf -
fi
tar cf - --one-file-system -C /usr/src/mybb-mybb_${MYBB_VERSION} . | tar xf -
echo >&2 "Complete! MyBB ${MYBB_VERSION} has been successfully copied to $PWD"
fi

Expand Down