Skip to content

Commit 476e046

Browse files
committed
Rebase to 3.21, support read-only operation
1 parent 9a88ade commit 476e046

File tree

5 files changed

+44
-38
lines changed

5 files changed

+44
-38
lines changed

Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -47,6 +47,17 @@ RUN \
4747
echo "**** install composer dependencies ****" && \
4848
composer install -d /app/www/ && \
4949
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
50+
echo "**** create symlinks ****" && \
51+
rm -rf /app/www/themes && ln -s /config/www/themes /app/www/themes && \
52+
rm -rf /app/www/storage/uploads/files && ln -s /config/www/files /app/www/storage/uploads/files && \
53+
rm -rf /app/www/storage/uploads/images && ln -s /config/www/images /app/www/storage/uploads/images && \
54+
rm -rf /app/www/public/uploads && ln -s /config/www/uploads /app/www/public/uploads && \
55+
rm -rf /app/www/storage/backup && ln -s /config/backups /app/www/storage/backups && \
56+
rm -rf /app/www/storage/framework/cache && ln -s /config/www/framework/cache /app/www/storage/framework/cache && \
57+
rm -rf /app/www/storage/framework/sessions && ln -s /config/www/framework/sessions /app/www/storage/framework/sessions && \
58+
rm -rf /app/www/storage/framework/views && ln -s /config/www/framework/views /app/www/storage/framework/views && \
59+
rm -rf /app/www/storage/logs/laravel.log && ln -s /config/log/bookstack/laravel.log /app/www/storage/logs/laravel.log && \
60+
rm -rf /app/www/.env && ln -s /config/www/.env /app/www/.env && \
5061
echo "**** cleanup ****" && \
5162
rm -rf \
5263
/tmp/* \

Dockerfile.aarch64

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -47,6 +47,17 @@ RUN \
4747
echo "**** install composer dependencies ****" && \
4848
composer install -d /app/www/ && \
4949
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
50+
echo "**** create symlinks ****" && \
51+
rm -rf /app/www/themes && ln -s /config/www/themes /app/www/themes && \
52+
rm -rf /app/www/storage/uploads/files && ln -s /config/www/files /app/www/storage/uploads/files && \
53+
rm -rf /app/www/storage/uploads/images && ln -s /config/www/images /app/www/storage/uploads/images && \
54+
rm -rf /app/www/public/uploads && ln -s /config/www/uploads /app/www/public/uploads && \
55+
rm -rf /app/www/storage/backup && ln -s /config/backups /app/www/storage/backups && \
56+
rm -rf /app/www/storage/framework/cache && ln -s /config/www/framework/cache /app/www/storage/framework/cache && \
57+
rm -rf /app/www/storage/framework/sessions && ln -s /config/www/framework/sessions /app/www/storage/framework/sessions && \
58+
rm -rf /app/www/storage/framework/views && ln -s /config/www/framework/views /app/www/storage/framework/views && \
59+
rm -rf /app/www/storage/logs/laravel.log && ln -s /config/log/bookstack/laravel.log /app/www/storage/logs/laravel.log && \
60+
rm -rf /app/www/.env && ln -s /config/www/.env /app/www/.env && \
5061
echo "**** cleanup ****" && \
5162
rm -rf \
5263
/tmp/* \

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ If you wish to use the extra functionality of BookStack such as email, LDAP and
9999

100100
The container will copy an exemplary .env file to /config/www/.env on your host system for you to use.
101101

102+
## Read-Only Operation
103+
104+
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
105+
106+
### Caveats
107+
108+
* `/tmp` must be mounted to tmpfs
109+
102110
## Usage
103111

104112
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
174182
| `-e DB_DATABASE=` | Database name |
175183
| `-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). |
176184
| `-v /config` | Persistent config files |
185+
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
177186

178187
## Environment variables from files (Docker secrets)
179188

@@ -337,6 +346,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
337346

338347
## Versions
339348

349+
* **17.12.24:** - Rebase to Alpine 3.21.
340350
* **11.10.24:** - Default to environment config over .env file config.
341351
* **06.09.24:** - Add php-exif for reading image EXIF data.
342352
* **27.05.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings.

readme-vars.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ param_ports:
3535
opt_param_usage_include_env: true
3636
opt_param_env_vars:
3737
- {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)."}
38+
readonly_supported: true
39+
readonly_message: |
40+
* `/tmp` must be mounted to tmpfs
3841
# application setup block
3942
app_setup_block_enabled: true
4043
app_setup_block: |
@@ -135,6 +138,7 @@ init_diagram: |
135138
"bookstack:latest" <- Base Images
136139
# changelog
137140
changelogs:
141+
- {date: "17.12.24:", desc: "Rebase to Alpine 3.21."}
138142
- {date: "11.10.24:", desc: "Default to environment config over .env file config."}
139143
- {date: "06.09.24:", desc: "Add php-exif for reading image EXIF data."}
140144
- {date: "27.05.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."}

root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,20 @@
44
# create directory structure
55
mkdir -p \
66
/config/www/{uploads,files,images,themes} \
7+
/config/www/framework/{cache,sessions,views} \
78
/config/backups \
89
/config/log/bookstack
910

11+
rm -rf /config/www/framework/{cache,sessions,views}/*
12+
1013
# check for .env and copy default if needed
1114
if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
1215
cp /app/www/.env.example /config/www/.env
1316
fi
1417

15-
# create symlinks
16-
symlinks=(
17-
/app/www/themes
18-
/app/www/storage/uploads/files
19-
/app/www/storage/uploads/images
20-
/app/www/public/uploads
21-
/app/www/.env
22-
)
23-
24-
for i in "${symlinks[@]}"; do
25-
if [[ -e "${i}" && ! -L "${i}" ]]; then
26-
rm -rf "${i}"
27-
fi
28-
if [[ ! -L "${i}" ]]; then
29-
ln -s /config/www/"$(basename "${i}")" "${i}"
30-
fi
31-
done
32-
33-
if [[ -e "/app/www/storage/backups" && ! -L "/app/www/storage/backups" ]]; then
34-
rm -rf "/app/www/storage/backups"
35-
fi
36-
if [[ ! -L "/app/www/storage/backups" ]]; then
37-
ln -s "/config/backups" "/app/www/storage/backups"
38-
fi
39-
40-
if [[ -e "/app/www/storage/logs" && ! -L "/app/www/storage/logs" ]]; then
41-
rm -rf "/app/www/storage/logs"
42-
fi
43-
if [[ ! -L "/app/www/storage/logs" ]]; then
44-
ln -s "/config/log/bookstack" "/app/www/storage/logs"
45-
fi
46-
4718
# Check for app key
4819
if [[ -z ${APP_KEY} ]]; then
49-
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
20+
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
5021
echo "The application key is missing, halting init!"
5122
echo "You can generate a key with: docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey"
5223
echo "And apply it to the APP_KEY environment variable."
@@ -72,10 +43,10 @@ echo "Waiting for DB to be available"
7243
END=$((SECONDS + 30))
7344
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
7445
if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then
75-
if [[ ! -f /dbwait.lock ]]; then
46+
if [[ ! -f /run/dbwait.lock ]]; then
7647
sleep 5
7748
fi
78-
touch /dbwait.lock
49+
touch /run/dbwait.lock
7950
break
8051
else
8152
sleep 1
@@ -87,5 +58,4 @@ php /app/www/artisan migrate --force
8758

8859
# permissions
8960
lsiown -R abc:abc \
90-
/app/www/storage \
9161
/config

0 commit comments

Comments
 (0)