Coding

Requirements

Build

Clone the repository and build the binary:

$ git clone git@github.com:datarhei/core.git
$ cd core
$ make

After the build process, the binary is available as core

For more build options, run make help.

Repository

Cross Compile

If you want to run the binary on a different operating system and/or architecture, you create the appropriate binary by simply setting some environment variables, e.g.

$ env GOOS=linux GOARCH=arm go build -o core-linux-arm
$ env GOOS=linux GOARCH=arm64 go build -o core-linux-arm64
$ env GOOS=freebsd GOARCH=amd64 go build -o core-freebsd-amd64
$ env GOOS=windows GOARCH=amd64 go build -o core-windows-amd64
$ env GOOS=macos GOARCH=amd64 go build -o core-macos-amd64
...

Docker

Build the Docker image and run it to try out the API with FFmpeg

$ docker build -t core .
$ docker build -f Dockerfile.bundle \
    --build-args CORE_IMAGE=core \
    --build-args FFMPEG_IMAGE=datarhei/base:alpine-ffmpeg-latest \
    -t core-bundle .
$ docker run -it --rm -v ${PWD}/data:/core/data -p 8080:8080 core-bundle

How to customize FFmpeg

Custom Docker images

Code style

The source code is formatted with go fmt, or run make fmt. Static analysis of the source code is done with staticcheck (see staticcheck), or run make lint.

Before committing changes, you should run make commit to ensure that the source code is in shape.

Last updated