2023-05-09 13:31:40 +00:00
|
|
|
FROM lukechannings/deno:v1.33.2
|
2022-12-07 17:43:47 +00:00
|
|
|
# The volume that will keep the space data
|
|
|
|
# Create a volume first:
|
|
|
|
# docker volume create myspace
|
|
|
|
# Then bind-mount it when running the container with the -v flag, e.g.:
|
|
|
|
# docker run -v myspace:/space -it zefhemel/silverbullet
|
|
|
|
VOLUME /space
|
2022-07-18 01:23:27 +00:00
|
|
|
|
2023-05-09 13:31:40 +00:00
|
|
|
# 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
|
|
|
|
|
2022-12-07 17:43:47 +00:00
|
|
|
# Copy the bundled version of silverbullet into the container
|
|
|
|
ADD ./dist/silverbullet.js /silverbullet.js
|
2022-07-18 17:48:19 +00:00
|
|
|
|
2022-12-07 17:43:47 +00:00
|
|
|
# Make sure the deno user has access to the space volume
|
2023-05-09 13:31:40 +00:00
|
|
|
RUN mkdir -p /space \
|
|
|
|
&& chown -R deno:deno /space \
|
|
|
|
&& chmod +x /tini \
|
|
|
|
&& echo "**** cleanup ****" \
|
|
|
|
&& apt-get -y autoremove \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm -rf \
|
|
|
|
/tmp/* \
|
|
|
|
/var/lib/apt/lists/* \
|
|
|
|
/var/tmp/* \
|
|
|
|
/var/log/* \
|
|
|
|
/usr/share/man
|
2022-12-07 17:43:47 +00:00
|
|
|
|
|
|
|
# deno user id is 1000 in alpine image
|
|
|
|
USER deno
|
|
|
|
|
|
|
|
# Expose port 3000
|
|
|
|
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port)
|
2022-07-18 01:23:27 +00:00
|
|
|
EXPOSE 3000
|
|
|
|
|
2022-12-07 17:43:47 +00:00
|
|
|
# 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
|
2023-05-09 13:31:40 +00:00
|
|
|
ENTRYPOINT ["/tini", "--", "deno", "run", "-A", "--unstable", "/silverbullet.js", "--hostname", "0.0.0.0", "/space"]
|