With Dockerfile
FROM ubuntu:oracular
RUN apt-get update
RUN apt install -y opam
RUN apt install -y build-essential
RUN opam init -y
RUN git clone https://git.sr.ht/~jonsterling/ocaml-forester
RUN cd ocaml-forester; opam pin -y .
RUN apt install -y curl
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain stable -y
ENV PATH=/root/.cargo/bin:$PATH
ENV PATH=/root/.opam/default/bin:$PATH
RUN cargo install forest-server
WORKDIR /app
CMD [ "forest", "watch", "--", "build --dev forest.toml" ]
one can build a docker image via `docker build . -t xxx:latest`.
Then create a compose configuration:
services:
xxx:
image: "xxx:latest"
working_dir: "<hostpath/to/forest>"
ports:
- "80:80"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`xxx.localhost`)"
- "traefik.http.routers.whoami.entrypoints=web"
volumes:
- "./:<hostpath/to/forest>"
traefik:
image: "traefik:v2.10"
container_name: "traefik"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
# Web UI
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
Then run `docker compose up -d`. With these setup, the forest
can be access via `xxx.localhost`, so one get a background service
for forest, just add new notes.
Best,
Tsú-thuàn