File tree Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM ubuntu:24.04
2+
3+ # Install additional dependencies
4+ RUN apt-get update && \
5+ apt-get install -y \
6+ git \
7+ wget \
8+ zip \
9+ unzip \
10+ php \
11+ php-bcmath php-curl php-mbstring php-gd php-xml php-zip php-mysql php-ldap \
12+ && \
13+ rm -rf /var/lib/apt/lists/*
14+
15+ # Take branch as an argument so we can choose which BookStack
16+ # branch to test against
17+ ARG BRANCH=development
18+
19+ # Download BookStack & install PHP deps
20+ RUN mkdir -p /var/www && \
21+ git clone https://github.com/bookstackapp/bookstack.git --branch "$BRANCH" --single-branch /var/www/bookstack && \
22+ cd /var/www/bookstack && \
23+ wget https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer -O - -q | php -- --quiet --filename=composer && \
24+ php composer install
25+
26+ # Set the BookStack dir as the default working dir
27+ WORKDIR /var/www/bookstack
28+
29+ # Set the default action as running php
30+ ENTRYPOINT ["/bin/php" ]
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ BRANCH=${1:- development}
4+
5+ # Build the container with a known name
6+ docker build --build-arg BRANCH=" $BRANCH " -t bookstack:db-testing .
7+
8+ # List of database containers to test against
9+ containers=(
10+ mysql:5.7
11+ mysql:8.0
12+ mysql:8.4
13+ mysql:9.5
14+ mariadb:10.2
15+ mariadb:10.6
16+ mariadb:10.11
17+ mariadb:11.4
18+ mariadb:11.8
19+ mariadb:12.0
20+ )
21+
22+ # Pre-clean-up from prior runs
23+ docker stop bs-dbtest-db
24+ docker network rm bs-dbtest-net
25+
26+ # Cycle over each database image
27+ for img in " ${containers[@]} " ; do
28+ echo " Starting tests with $img ..."
29+ docker network create bs-dbtest-net
30+ docker run -d --rm --name " bs-dbtest-db" \
31+ -e MYSQL_DATABASE=bookstack-test -e MYSQL_USER=bookstack -e MYSQL_PASSWORD=bookstack -e MYSQL_ROOT_PASSWORD=password \
32+ --network=bs-dbtest-net \
33+ " $img "
34+ sleep 10
35+ APP_RUN=' docker run -it --rm --network=bs-dbtest-net -e TEST_DATABASE_URL="mysql://bookstack:bookstack@bs-dbtest-db:3306" bookstack:db-testing'
36+ $APP_RUN artisan migrate --force --database=mysql_testing
37+ $APP_RUN artisan db:seed --force --class=DummyContentSeeder --database=mysql_testing
38+ $APP_RUN vendor/bin/phpunit
39+ if [ $? -eq 0 ]; then
40+ echo " $img - Success"
41+ else
42+ echo " $img - Error"
43+ read -p " Stop script? [y/N] " ans
44+ [[ $ans == [yY] ]] && exit 0
45+ fi
46+
47+ docker stop " bs-dbtest-db"
48+ docker network rm bs-dbtest-net
49+ done
50+
You can’t perform that action at this time.
0 commit comments