Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker files #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine
RUN apk --update add git zola python3 rsync py3-pip curl g++ && \
ln -s /usr/bin/python3 /usr/bin/python && \
pip3 install python-slugify rtoml && \
git clone https://github.com/ppeetteerrs/obsidian-zola && \
mkdir /obsidian
ENV VAULT=/obsidian
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y && \
source ~/.cargo/env && \
cargo install obsidian-export
ENV PATH="$HOME/.cargo/bin:$PATH"
COPY entrypoint.sh /
RUN cp $HOME/.cargo/bin/obsidian-export /obsidian-zola/bin/obsidian-export && \
sed -i 's|zola --root=build serve|zola --root=build serve --interface 0.0.0.0 --base-url $SITE_URL|' /obsidian-zola/local-run.sh && \
chmod +x /entrypoint.sh

EXPOSE 1111
WORKDIR /obsidian-zola
#ENTRYPOINT ["tail", "-f", "/dev/null"]
ENTRYPOINT [ "/entrypoint.sh" ]
#CMD []
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2'

services:
obsidian_server:
build:
context: .
container_name: obsidian
restart: always
environment:
- TZ=Asia/Taipei
- SITE_URL=""
volumes:
- ./obsidian:/obsidian
ports:
- "1111:1111"
command: sh local-run.sh
16 changes: 16 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
if [ -f /obsidian/netlify.toml ]; then
echo 'good luck'
cd /obsidian-zola
sh local-run.sh
sleep infinity
else
echo "netlify.toml not found in the bind mount to /obsidian"
cd /obsidian
cp /obsidian-zola/netlify.example.toml /obsidian/netlify.toml
echo You should set SITE_URL to your public ip, now SITE_URL is $SITE_URL
sed -i 's|SITE_URL = ""|SITE_URL = "'"$SITE_URL"'"|' /obsidian/netlify.toml
cd /obsidian-zola
sh local-run.sh
sleep infinity
fi