Skip to content

Commit 3298374

Browse files
committed
Merge branch 'docker-simplify' into development
2 parents fdbbcf2 + 227c5e1 commit 3298374

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

dev/docker/Dockerfile

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
FROM php:8.3-apache
22

3-
ENV APACHE_DOCUMENT_ROOT /app/public
4-
WORKDIR /app
5-
6-
RUN <<EOR
73
# Install additional dependencies
8-
apt-get update
9-
apt-get install -y \
10-
git \
11-
zip \
12-
unzip \
13-
libpng-dev \
14-
libldap2-dev \
15-
libzip-dev \
16-
wait-for-it
17-
rm -rf /var/lib/apt/lists/*
4+
RUN apt-get update && \
5+
apt-get install -y \
6+
git \
7+
zip \
8+
unzip \
9+
libfreetype-dev \
10+
libjpeg62-turbo-dev \
11+
libldap2-dev \
12+
libpng-dev \
13+
libzip-dev \
14+
wait-for-it && \
15+
rm -rf /var/lib/apt/lists/*
1816

19-
# Configure apache
20-
docker-php-ext-configure ldap --with-libdir="lib/$(gcc -dumpmachine)"
21-
docker-php-ext-install pdo_mysql gd ldap zip
22-
pecl install xdebug
23-
docker-php-ext-enable xdebug
24-
a2enmod rewrite
25-
sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
26-
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
17+
# Install PHP extensions
18+
RUN docker-php-ext-configure ldap --with-libdir="lib/$(gcc -dumpmachine)" && \
19+
docker-php-ext-configure gd --with-freetype --with-jpeg && \
20+
docker-php-ext-install -j$(nproc) pdo_mysql gd ldap zip && \
21+
pecl install xdebug && \
22+
docker-php-ext-enable xdebug
2723

2824
# Install composer
29-
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
25+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
26+
27+
# Configure apache
28+
RUN a2enmod rewrite && \
29+
sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
30+
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
3031

3132
# Use the default production configuration and update it as required
32-
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
33-
sed -i 's/memory_limit = 128M/memory_limit = 512M/g' "$PHP_INI_DIR/php.ini"
34-
EOR
33+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
34+
sed -i 's/memory_limit = 128M/memory_limit = 512M/g' "$PHP_INI_DIR/php.ini"
35+
36+
ENV APACHE_DOCUMENT_ROOT="/app/public"
37+
38+
WORKDIR /app

dev/docker/entrypoint.app.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [[ -n "$1" ]]; then
99
else
1010
composer install
1111
wait-for-it db:3306 -t 45
12-
php artisan migrate --database=mysql
13-
chown -R www-data:www-data storage
12+
php artisan migrate --database=mysql --force
13+
chown -R www-data storage public/uploads bootstrap/cache
1414
exec apache2-foreground
1515
fi

dev/docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If all the conditions are met, you can proceed with the following steps:
8282

8383
1. **Copy `.env.example` to `.env`**, change `APP_KEY` to a random 32 char string and set `APP_ENV` to `local`.
8484
2. Make sure **port 8080 is unused** *or else* change `DEV_PORT` to a free port on your host.
85-
3. **Run `chgrp -R docker storage`**. The development container will chown the `storage` directory to the `www-data` user inside the container so BookStack can write to it. You need to change the group to your host's `docker` group here to not lose access to the `storage` directory.
85+
3. **Run `chgrp -R docker storage`**. The development container will chown the `storage`, `public/uploads` and `bootstrap/cache` directories to the `www-data` user inside the container so BookStack can write to it. You need to change the group to your host's `docker` group here to not lose access to the `storage` directory.
8686
4. **Run `docker-compose up`** and wait until the image is built and all database migrations have been done.
8787
5. You can now login with `[email protected]` and `password` as password on `localhost:8080` (or another port if specified).
8888

0 commit comments

Comments
 (0)