Running Scrumdog with Docker

25 Feb 2025 in TIL

I was intrigued by the idea of Scrumdog, which allows you to export Jira tickets to a sqlite database.

Unfortunately the website is now offline, and the provided binaries don't work on non-intel macs. Thankfully, Scrumdog is open source so I can just build it myself... except that it's written in OCaml and I don't have any of the toolchain installed and don't really want to install it just for one project.

So, I reached for Docker.

It seems as though the opam dependency file isn't configured correctly for scrumdog, so here's a Dockerfile that explicitly installs the correct libraries:

bash
# Build a base image with updated dependencies
FROM ocaml/opam:alpine AS init-opam
RUN set -x && \
: "Update and upgrade default packages" && \
sudo apk update && sudo apk upgrade && \
sudo apk add gmp-dev sqlite-dev
# Install opam dependencies explicitly then build scrumdog
FROM init-opam AS ocaml-app-base
COPY . .
RUN set -x && \
: "Install related packages" && \
opam install dune yojson sqlite3 cohttp-lwt-unix tls-lwt && \
eval $(opam env) && \
: "Build applications"
RUN eval $(opam env) && dune build
# Install dependencies + copy the built executable
FROM alpine AS ocaml-app
COPY --from=ocaml-app-base /home/opam/_build/default/bin/scrumdog.exe /home/bin/main.exe
RUN set -x && \
: "Update and upgrade default packages" && \
apk update && apk upgrade && \
apk add gmp-dev sqlite-dev && \
: "Create a user to execute application" && \
adduser -D app && \
: "Change owner to app" && \
chown app:app /home/bin/main.exe
WORKDIR /home/app
USER app
ENTRYPOINT ["/home/bin/main.exe"]

Finally, build the image and run it.

bash
docker build -t scrumdog-local .
docker run --rm -v $PWD:/home/app scrumdog-local -j

This generates a sample.jql file in the current directory that you can edit and use as a configuration file:

bash
docker run --rm -v $PWD:/home/app scrumdog-local sample.jql