forked from silverbulletmd/silverbullet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (45 loc) · 1.78 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM denoland/deno:debian-2.0.6
# The volume that will keep the space data
# Either create a volume:
# docker volume create myspace
# Then bind-mount it when running the container with the -v flag, e.g.:
# docker run -v myspace:/space -p3000:3000 -it zefhemel/silverbullet
# Or simply mount an existing folder into the container:
# docker run -v /path/to/my/folder:/space -p3000:3000 -it zefhemel/silverbullet
VOLUME /space
# Accept TARGETARCH as argument
ARG TARGETARCH
# Adding tini manually, as it's not included anymore in the new baseimage
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
# Make sure the deno user has access to the space volume
RUN mkdir -p -m 777 /space \
&& chmod +x /tini \
&& apt update \
&& apt install -y git ssh-client \
&& echo "**** cleanup ****" \
&& apt-get -y autoremove \
&& apt-get clean \
&& mkdir -p /deno-dir \
&& chmod 777 /deno-dir \
&& rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
/var/log/* \
/usr/share/man
# Expose port 3000
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port)
EXPOSE 3000
# Always binding to this IP, otherwise the server wouldn't be available
ENV SB_HOSTNAME 0.0.0.0
ENV SB_FOLDER /space
# Copy the bundled version of silverbullet into the container
ADD ./dist/silverbullet.js /silverbullet.js
# Precache any remaining dependencies
RUN deno cache /silverbullet.js
# As well as the docker-entrypoint.sh script
ADD ./docker-entrypoint.sh /docker-entrypoint.sh
# Run the server, allowing to pass in additional argument at run time, e.g.
# docker run -p 3002:3000 -v myspace:/space -it zefhemel/silverbullet --user me:letmein
ENTRYPOINT ["/tini", "--", "/docker-entrypoint.sh"]