Skip to content

Commit 40d298b

Browse files
committed
Added automatic script running from CONTAINER_BOOT page
This replaces the old SB_APT_PACKAGES feature (which is still there, just deprecated for now).
1 parent c74e878 commit 40d298b

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

docker-entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
# Run last-minute package installs
3+
# Run last-minute package installs, DEPRECATED
44
if [ -n "$SB_APT_PACKAGES" ]; then
55
if [ "$UID" == "0" ]; then
66
if [ -n "$SB_APT_SYNC" ]; then
@@ -14,6 +14,12 @@ if [ -n "$SB_APT_PACKAGES" ]; then
1414
fi
1515
fi
1616

17+
# If a /space/CONTAINER_BOOT.md file exists, execute it as a bash script upon boot
18+
if [ -f "/space/CONTAINER_BOOT.md" ]; then
19+
echo "Executing CONTAINER_BOOT.md script"
20+
bash /space/CONTAINER_BOOT.md &
21+
fi
22+
1723
# Check if UID and GID are passed as environment variables, if not, extract from the space folder owner
1824
if [ -z "$PUID" ] && [ "$UID" == "0" ] ; then
1925
# Get the UID of the folder owner

website/CONTAINER_BOOT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Update the repos
2+
apt update
3+
4+
# Install additional packages
5+
apt install -y pandoc

website/Install/Configuration.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ Configuration only relevant to docker deployments:
4141

4242
* `PUID`: Runs the server process with the specified UID (default: whatever user owns the `/space` mapped folder)
4343
* `PGID`: Runs the server process with the specified GID (default: whatever group owns the `/space` mapped folder)\
44-
* `SB_APT_PACKAGES`: will install additional (ubuntu) packages inside the container upon boot. Example: `SB_APT_PACKAGES="ripgrep pandoc"`
45-
**Note:** This installation happens asynchronously in the background (you can see it happen in the server output) unless `SB_APT_SYNC` is set (see bellow)
46-
* `SB_APT_SYNC`: when set, will _first_ install APT packages configured with `SB_APT_PACKAGES` before booting SilverBullet itself.
4744

4845
# Web app manifest
4946
Configure aspects of web app appearance:

website/Install/Docker.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ There you go!
4141

4242
Note that to get offline mode to work you need to serve SilverBullet with HTTPS, via for example a reverse proxy.
4343

44+
# Installing additional packages
45+
46+
If you would like to install additional packages into your docker container (e.g. to call via [[API/shell]]), you can do so by creating a [[CONTAINER_BOOT]] page in your space.
47+
48+
In this page, put `apt` commands install the (ubuntu) packages you would like to install.
49+
50+
This page will be run as a bash script upon container boot (hence its name). You can monitor its progress by checking your server’s logs.
51+
4452
# Versions
4553
As we’re working on SilverBullet v2, your only real option is to use the “edge” versions with the `:v2` tag.
4654

0 commit comments

Comments
 (0)