Skip to content

Commit e471807

Browse files
committed
Switch docker image to ubuntu, add ability to install additional packages
1 parent a8d7cd1 commit e471807

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Note: we don't actually need a Deno image, since we use a single-binary distribution of SilverBullet
2-
# However, since those binaries still depend on a bunch of GLIBC stuff included in the deno image —— we'll just go with that anyway
3-
FROM denoland/deno:alpine
1+
FROM ubuntu:noble
42

53
# The volume that will keep the space data
64
VOLUME /space
@@ -19,11 +17,13 @@ ARG TARGETARCH
1917
ENV TINI_VERSION=v0.19.0
2018
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
2119

22-
# Make sure the deno user has access to the space volume
2320
RUN mkdir -p -m 777 /space \
2421
&& chmod +x /tini \
25-
# We will just include bash and git
26-
&& apk add bash git
22+
&& apt update \
23+
&& apt install -y git \
24+
&& apt-get -y autoremove \
25+
&& apt-get clean \
26+
&& rm -rf /tmp/* /var/tmp/* /var/log/* /usr/share/man /var/lib/apt/lists/*
2727

2828
# Expose port 3000
2929
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port)

docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/bin/bash -e
22

3+
# Run last-minute package installs
4+
if [ -n "$SB_APT_PACKAGES" ]; then
5+
if [ "$UID" == "0" ]; then
6+
apt update -y
7+
apt install -y $SB_APT_PACKAGES
8+
else
9+
echo "Cannot install packages selected via SB_APT_PACKAGES unless run as root"
10+
fi
11+
fi
12+
313
# Check if UID and GID are passed as environment variables, if not, extract from the space folder owner
414
if [ -z "$PUID" ] && [ "$UID" == "0" ] ; then
515
# Get the UID of the folder owner

website/Install/Configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ SilverBullet enables plugs to run shell commands. This is potentially unsafe. If
3939
Configuration only relevant to docker deployments:
4040

4141
* `PUID`: Runs the server process with the specified UID (default: whatever user owns the `/space` mapped folder)
42-
* `GUID`: Runs the server process with the specified GID (default: whatever group owns the `/space` mapped folder)
42+
* `GUID`: Runs the server process with the specified GID (default: whatever group owns the `/space` mapped folder)\
43+
* `SB_APT_PACKAGES`: will install additional (ubuntu) packages inside the container upon boot. Example: `SB_APT_PACKAGES="ripgrep pandoc"`
44+
**Warning:** this will (probably) significantly increase the boot time of your container.
4345

4446
# Web app manifest
4547
Configure aspects of web app appearance:

website/Install/Docker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A few key things to know about the SilverBullet container image:
1212
* The container binds to port `3000`, so be sure to port-map that, e.g. via `-p 3000:3000` (note: the first `3000` is the external port)
1313
* The container uses whatever is volume-mapped to `/space` as the space root folder. You can connect a docker volume, or a host folder to this, e.g. `-v /home/myuser/space:/space`
1414
* SilverBullet will detect the UNIX owner (UID and GID) of the folder mapped into `/space` and run the server process with the same UID and GID so that permissions will just magically work. If you’d like to override this UID, set the `PUID` and `PGID` environment variables (see [[Install/Configuration]] for details).
15+
* The Docker image is based on Ubuntu. If you would like to install additional packages into it at runtime, you can do so via the `SB_APT_PACKAGES` environment variable, see [[Install/Configuration]].
1516

1617
> **note** Note
1718
> The same docker images are currently both available from [GHCR](https://github.com/silverbulletmd/silverbullet/pkgs/container/silverbullet) and [Docker Hub](https://hub.docker.com/r/zefhemel/silverbullet), use whichever you prefer.

0 commit comments

Comments
 (0)