Table of Contents
Docker
For multiarch support, the provided Dockerfile
uses Docker buildx, which means you can't just build it with your regular docker build
. To use it, you need to enable experimental features in /etc/docker/daemon.json
or $HOME/.docker/config.json
or instead by setting the environment variable DOCKER_CLI_EXPERIMENTAL=enabled
to temporarily enable it.
⟩ cat /etc/docker/daemon.json
{
"experimental": true
}
You should then be able to run docker buildx
and get a help page. If not, see the build instructions to manually install it.
To build and load the container, you can then run
⟩ git clone https://github.com/hrfee/jfa-go.git
⟩ cd jfa-go/
⟩ docker buildx build -t hrfee/jfa-go:unstable --load .
Native
- Note: The build process doesn't really work on Windows, and I doubt there's a need for first class support. Your best bet is to build in WSL with either method below and the
GOOS=windows
environment variable set.
To build, you need to compile the typescript and go, and generate email templates and config files. The build scripts were mostly ripped out of jf-accounts, so you'll need similar dependencies:
required:
git
python >= 3.6
go >= 1.16
node.js and npm (for tsc/esbuild and mjml)
upx (optional, to compress the executable)
optional:
libappindicator3-dev or equivalent (if building with tray icon)
gcc-mingw-w64-x86-64 or equivalent (if cross-compiling for windows on linux/macOS)
The main dependencies of the program will be automatically downloaded on compilation and can be seen in go.mod.
Makefile
A Makefile is provided, which requires the make
command. Simply clone the repository and run make all
to grab all necessary dependencies for go/python/node, compile everything and place the executable and app data inside build/
. You can optionally compress the executable by running make compress
after.
-
You can add the following flags with
make all FLAGNAME=VALUE
:DEBUG=on
: doesn't strip binaries and includes typescript sourcemaps.INTERNAL=off
: Defaults to on, this disables embedding so assets are stored in thedata/
folder next to the binary. Useful for customizing after compilation.UPDATER=on/off/docker
: Enables/disables the updater, which pings build.hrfee.pw every 30 mins for new updates. New updates are shown with a download link to the user. WhenINTERNAL=on
, updates are automatically downloaded, and installed upon request.TRAY=on
: Enables a tray icon, which lets you start/stop/autostart on login. For linux, requireslibappindicator3-dev
for debian or the equivalent on other distributions.
-
If you get an error from npm regarding esbuild, this is because a precompiled binary for your system's architecture isn't available on npm. run
make all GOESBUILD=on
instead to have it compiled instead. -
You can optionally provide the path/name of the
go
executable manually withmake all GOBINARY=<path to go>
.
Goreleaser
goreleaser is used to publish the packages seen in the release section.
-
To generate executables for multiple platforms, run
./scripts/version.sh goreleaser build --snapshot --rm-dist
. They will be stored indist/
-
To generate package archives that include
LICENSE
andREADME.md
, run./scripts/version.sh goreleaser --snapshot --skip-publish --rm-dist
.