Rebase to 3.21, support read-only operation

This commit is contained in:
thespad 2024-12-17 17:55:20 +00:00
parent 9a88ade8e1
commit 476e0463b1
No known key found for this signature in database
5 changed files with 44 additions and 38 deletions

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.20
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.21
# set version label
ARG BUILD_DATE
@ -47,6 +47,17 @@ RUN \
echo "**** install composer dependencies ****" && \
composer install -d /app/www/ && \
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
echo "**** create symlinks ****" && \
rm -rf /app/www/themes && ln -s /config/www/themes /app/www/themes && \
rm -rf /app/www/storage/uploads/files && ln -s /config/www/files /app/www/storage/uploads/files && \
rm -rf /app/www/storage/uploads/images && ln -s /config/www/images /app/www/storage/uploads/images && \
rm -rf /app/www/public/uploads && ln -s /config/www/uploads /app/www/public/uploads && \
rm -rf /app/www/storage/backup && ln -s /config/backups /app/www/storage/backups && \
rm -rf /app/www/storage/framework/cache && ln -s /config/www/framework/cache /app/www/storage/framework/cache && \
rm -rf /app/www/storage/framework/sessions && ln -s /config/www/framework/sessions /app/www/storage/framework/sessions && \
rm -rf /app/www/storage/framework/views && ln -s /config/www/framework/views /app/www/storage/framework/views && \
rm -rf /app/www/storage/logs/laravel.log && ln -s /config/log/bookstack/laravel.log /app/www/storage/logs/laravel.log && \
rm -rf /app/www/.env && ln -s /config/www/.env /app/www/.env && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/* \

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.20
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.21
# set version label
ARG BUILD_DATE
@ -47,6 +47,17 @@ RUN \
echo "**** install composer dependencies ****" && \
composer install -d /app/www/ && \
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
echo "**** create symlinks ****" && \
rm -rf /app/www/themes && ln -s /config/www/themes /app/www/themes && \
rm -rf /app/www/storage/uploads/files && ln -s /config/www/files /app/www/storage/uploads/files && \
rm -rf /app/www/storage/uploads/images && ln -s /config/www/images /app/www/storage/uploads/images && \
rm -rf /app/www/public/uploads && ln -s /config/www/uploads /app/www/public/uploads && \
rm -rf /app/www/storage/backup && ln -s /config/backups /app/www/storage/backups && \
rm -rf /app/www/storage/framework/cache && ln -s /config/www/framework/cache /app/www/storage/framework/cache && \
rm -rf /app/www/storage/framework/sessions && ln -s /config/www/framework/sessions /app/www/storage/framework/sessions && \
rm -rf /app/www/storage/framework/views && ln -s /config/www/framework/views /app/www/storage/framework/views && \
rm -rf /app/www/storage/logs/laravel.log && ln -s /config/log/bookstack/laravel.log /app/www/storage/logs/laravel.log && \
rm -rf /app/www/.env && ln -s /config/www/.env /app/www/.env && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/* \

View File

@ -99,6 +99,14 @@ If you wish to use the extra functionality of BookStack such as email, LDAP and
The container will copy an exemplary .env file to /config/www/.env on your host system for you to use.
## Read-Only Operation
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
### Caveats
* `/tmp` must be mounted to tmpfs
## Usage
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
@ -174,6 +182,7 @@ Containers are configured using parameters passed at runtime (such as those abov
| `-e DB_DATABASE=` | Database name |
| `-e QUEUE_CONNECTION=` | Set to `database` to enable async actions like sending email or triggering webhooks. See [documentation](https://www.bookstackapp.com/docs/admin/email-webhooks/#async-action-handling). |
| `-v /config` | Persistent config files |
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
## Environment variables from files (Docker secrets)
@ -337,6 +346,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **17.12.24:** - Rebase to Alpine 3.21.
* **11.10.24:** - Default to environment config over .env file config.
* **06.09.24:** - Add php-exif for reading image EXIF data.
* **27.05.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings.

View File

@ -35,6 +35,9 @@ param_ports:
opt_param_usage_include_env: true
opt_param_env_vars:
- {env_var: "QUEUE_CONNECTION", env_value: "", desc: "Set to `database` to enable async actions like sending email or triggering webhooks. See [documentation](https://www.bookstackapp.com/docs/admin/email-webhooks/#async-action-handling)."}
readonly_supported: true
readonly_message: |
* `/tmp` must be mounted to tmpfs
# application setup block
app_setup_block_enabled: true
app_setup_block: |
@ -135,6 +138,7 @@ init_diagram: |
"bookstack:latest" <- Base Images
# changelog
changelogs:
- {date: "17.12.24:", desc: "Rebase to Alpine 3.21."}
- {date: "11.10.24:", desc: "Default to environment config over .env file config."}
- {date: "06.09.24:", desc: "Add php-exif for reading image EXIF data."}
- {date: "27.05.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."}

View File

@ -4,49 +4,20 @@
# create directory structure
mkdir -p \
/config/www/{uploads,files,images,themes} \
/config/www/framework/{cache,sessions,views} \
/config/backups \
/config/log/bookstack
rm -rf /config/www/framework/{cache,sessions,views}/*
# check for .env and copy default if needed
if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
cp /app/www/.env.example /config/www/.env
fi
# create symlinks
symlinks=(
/app/www/themes
/app/www/storage/uploads/files
/app/www/storage/uploads/images
/app/www/public/uploads
/app/www/.env
)
for i in "${symlinks[@]}"; do
if [[ -e "${i}" && ! -L "${i}" ]]; then
rm -rf "${i}"
fi
if [[ ! -L "${i}" ]]; then
ln -s /config/www/"$(basename "${i}")" "${i}"
fi
done
if [[ -e "/app/www/storage/backups" && ! -L "/app/www/storage/backups" ]]; then
rm -rf "/app/www/storage/backups"
fi
if [[ ! -L "/app/www/storage/backups" ]]; then
ln -s "/config/backups" "/app/www/storage/backups"
fi
if [[ -e "/app/www/storage/logs" && ! -L "/app/www/storage/logs" ]]; then
rm -rf "/app/www/storage/logs"
fi
if [[ ! -L "/app/www/storage/logs" ]]; then
ln -s "/config/log/bookstack" "/app/www/storage/logs"
fi
# Check for app key
if [[ -z ${APP_KEY} ]]; then
if ! grep -qE "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /app/www/.env 2> /dev/null || grep -qE "APP_KEY=SomeRandomString" /app/www/.env 2> /dev/null; then
if ! grep -qE "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /config/www/.env 2> /dev/null || grep -qE "APP_KEY=SomeRandomString" /config/www/.env 2> /dev/null; then
echo "The application key is missing, halting init!"
echo "You can generate a key with: docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey"
echo "And apply it to the APP_KEY environment variable."
@ -72,10 +43,10 @@ echo "Waiting for DB to be available"
END=$((SECONDS + 30))
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then
if [[ ! -f /dbwait.lock ]]; then
if [[ ! -f /run/dbwait.lock ]]; then
sleep 5
fi
touch /dbwait.lock
touch /run/dbwait.lock
break
else
sleep 1
@ -87,5 +58,4 @@ php /app/www/artisan migrate --force
# permissions
lsiown -R abc:abc \
/app/www/storage \
/config