I’d like to test #751 on my own instance, but installing all the build
dependencies on my server isn’t ideal - having this script in the repo
would make it possible to simply point my compose file to the git repo
and have it build the Linux binary itself.
Note that it uses a somewhat “inefficient” builder step, i.e. not
combining steps together to reduce layers, as it uses a multi-stage
build to have a lean final image. This makes it easier to re-build if
something needs to change, as the cache is used more optimally.
For example, if only some go files change, most of the build is already
cached and only the go step gets re-run.
The more “efficient” builder step would look like this, but would have
to build the docs, web app and go CLI for any change in any file:
```Dockerfile
FROM golang:1.19-bullseye as builder
RUN apt-get update && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash && \
apt-get install -y \
build-essential \
nodejs \
python3-pip
WORKDIR /app
ADD . .
RUN make web docs cli-linux-server
```
`apt` is for interactive shell usage, using it in a script results in a
warning as the CLI interface is not stable
> WARNING: apt does not have a stable CLI interface.
> Use with caution in scripts.
sequentially and in-order.
If this is not set, make -j2 web or higher job counts will
cause the build to fail as some dependencies are not expressed
directly on the dependent tasks but as a dependency list
on a parent task.
Alternatively one could add the required dependencies for each
task separately, but that would factually sequentiallize the
build, so there's no real difference except this approach
fixes all dependency chains globally.