Skip to content

Commit

Permalink
allow the wiki to be hosted locally on watch mode (#422)
Browse files Browse the repository at this point in the history
* allow the wiki to be hosted locally on watch mode

* improve code & add wrap button

* Revert "improve code & add wrap button"

This reverts commit 81a0d88.

* Update Dockerfile

Co-authored-by: Bartłomiej Skoczeń <bartek_skoczen@protonmail.com>

* Update dev.sh

Co-authored-by: Bartłomiej Skoczeń <bartek_skoczen@protonmail.com>

* Change the image to Ubuntu and use gh cli to get packages

* remove curl

---------

Co-authored-by: Bartłomiej Skoczeń <bartek_skoczen@protonmail.com>
  • Loading branch information
oriel-beck and MineBartekSA committed Jul 25, 2024
1 parent 8dcb2f0 commit ee17009
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use an Ubuntu base image
FROM ubuntu

# Install gh cli
RUN (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
&& mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y

# Set config to ssh to bypass auth login
RUN gh config set git_protocol ssh -h github.com

# Download required packages
RUN gh release download -R rust-lang/mdBook -p mdbook-*-x86_64-unknown-linux-gnu.tar.gz
RUN gh release download -R tommilligan/mdbook-admonish -p mdbook-admonish-*-x86_64-unknown-linux-gnu.tar.gz
RUN gh release download -R NilPointer-Software/mdbook-discord-components -p mdbook-discord-components-*.tar.gz

# Set the working directory for your mdbook project
WORKDIR /app

# Expose working port
EXPOSE 3000

# Copy dev run script
COPY dev.sh .

# Run your start script
CMD ["sh", "dev.sh"]
7 changes: 7 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for file in /*.tar.gz
do tar xzf "$file" -C /usr/local/bin
rm $file
done

mdbook-admonish install --css-dir src/theme
mdbook serve --port 3000 -n 0.0.0.0
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
mdbook-service:
build: .
volumes:
- ./:/app:rw
ports:
- "3000:3000"

0 comments on commit ee17009

Please sign in to comment.