CookCLI icon indicating copy to clipboard operation
CookCLI copied to clipboard

Add Dockerfile

Open leonbeon opened this issue 2 years ago • 3 comments

I think adding a Dockerfile would really benefit this project! Here is the one I currently use for a Raspberry Pi, based on Alpine Linux.

from alpine:3.18

ARG DOWNLOAD_URL="https://github.com/cooklang/cookcli/releases/latest/download/cook-aarch64-unknown-linux-musl.tar.gz"

# Set workdir to /app
WORKDIR /app

# Download CookCLI file
ADD ${DOWNLOAD_URL} .

# Untar binary
RUN tar -xvf cook-*

# Remove tar
RUN rm *.tar.gz

# Expose default port (9080)
EXPOSE 9080

# Run Server
ENTRYPOINT ["./cook", "server", "--host", "./recipes"]

You could overwrite the download URL with --build-arg, currently it points to the latest build of the aarch64 version. Also, I'm not sure if logs would be redirected to docker logs output, since it seems like the cook binary doesn't output anything anyway?

Also, I spent hours realising that the --host argument is missing. Maybe add that to the docs?

leonbeon avatar Dec 30 '23 14:12 leonbeon

@leonbeon I'm not certain I understand the motivation for this docker file. I guess the goal is to have a server running, but why not to use default system tools for that (systemd for Linux, launchd for MacOS, probably something exists for Windows too)? Using Docker is a very narrow use-case.

dubadub avatar Jan 02 '24 10:01 dubadub

Good point about the docs, it still refers old Swift base CLI, need to update.

dubadub avatar Jan 02 '24 10:01 dubadub

I think the benefit of having a Dockerfile on the top level of the repo is that you can build directly from GitHub. But you're right, using Docker is just one of many ways to build this. Then again, why not also add a systemd config for easy deployment?

leonbeon avatar Jan 02 '24 20:01 leonbeon