feat: add setup
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm install -g obsidian-headless@latest
|
||||
|
||||
WORKDIR /vault
|
||||
|
||||
COPY <<'EOF' /usr/local/bin/entrypoint.sh
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CONFIG_DIR=/root/.config/obsidian-headless
|
||||
|
||||
if [ ! -f "$CONFIG_DIR/auth_token" ]; then
|
||||
echo "[obsidian-headless] not logged in — run:"
|
||||
echo " docker exec -it beaver-obsidian ob login"
|
||||
echo "then restart this container."
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
if ! ls "$CONFIG_DIR"/sync/*/config.json >/dev/null 2>&1; then
|
||||
echo "[obsidian-headless] vault not configured — run:"
|
||||
echo " docker exec -it beaver-obsidian ob sync-setup --vault '<vault name>'"
|
||||
echo "then restart this container."
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
exec ob sync --continuous
|
||||
EOF
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
Reference in New Issue
Block a user