diff --git a/.env.dist b/.env.dist new file mode 100644 index 00000000..66c10097 --- /dev/null +++ b/.env.dist @@ -0,0 +1,6 @@ +# GOOS variable for your local development; since the Go docker images are +# Linux based, in case you are developing on MacOS you must uncomment the line below. +#GOOS=darwin + +# GOARCH the architecture to be used for kool run compile script. +#GOARCH=amd64 diff --git a/.gitignore b/.gitignore index fbf453ae..788a3dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /kool /dist/ +/.env # IDE .vscode/ diff --git a/Dockerfile b/Dockerfile index cecef217..c8342619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM docker/compose:alpine-1.26.2 AS docker-compose -FROM golang:1.14 AS build +FROM golang:1.15.0 AS build WORKDIR /app diff --git a/build.sh b/build.sh deleted file mode 100755 index ff97fc75..00000000 --- a/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -bash parse_presets.sh - -go build -o /usr/local/bin/kool - -# docker run --rm --env GOOS=linux --env GOARCH=amd64 -v $(pwd):/code -w /code golang:1.14 go build -tags netgo -ldflags '-extldflags "-static"' -o dist/kool-linux-amd64 diff --git a/build_artifacts.sh b/build_artifacts.sh index cf851848..2068e2f2 100755 --- a/build_artifacts.sh +++ b/build_artifacts.sh @@ -1,23 +1,29 @@ #!/bin/bash +if [ -f .env ]; then + source .env +fi + +GO_IMAGE=${GO_IMAGE:-golang:1.15.0} + rm -rf dist mkdir -p dist echo "Building to GOOS=darwin GOARCH=amd64" -docker run --rm --env GOOS=darwin --env GOARCH=amd64 --env CGO_ENABLED=0 -v $(pwd):/code -w /code golang:1.14 go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-darwin-x86_64 +docker run --rm --env GOOS=darwin --env GOARCH=amd64 --env CGO_ENABLED=0 -v $(pwd):/code -w /code $GO_IMAGE go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-darwin-x86_64 echo "Building to GOOS=linux GOARCH=amd64" -docker run --rm --env GOOS=linux --env GOARCH=amd64 --env CGO_ENABLED=0 -v $(pwd):/code -w /code golang:1.14 go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-x86_64 +docker run --rm --env GOOS=linux --env GOARCH=amd64 --env CGO_ENABLED=0 -v $(pwd):/code -w /code $GO_IMAGE go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-x86_64 echo "Building to GOOS=linux GOARCH=arm GOARM=6" -docker run --rm --env GOOS=linux --env GOARCH=arm --env GOARM=6 --env CGO_ENABLED=0 -v $(pwd):/code -w /code golang:1.14 go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-arm6 +docker run --rm --env GOOS=linux --env GOARCH=arm --env GOARM=6 --env CGO_ENABLED=0 -v $(pwd):/code -w /code $GO_IMAGE go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-arm6 echo "Building to GOOS=linux GOARCH=arm GOARM=7" -docker run --rm --env GOOS=linux --env GOARCH=arm --env GOARM=7 --env CGO_ENABLED=0 -v $(pwd):/code -w /code golang:1.14 go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-arm7 +docker run --rm --env GOOS=linux --env GOARCH=arm --env GOARM=7 --env CGO_ENABLED=0 -v $(pwd):/code -w /code $GO_IMAGE go build -a -tags 'osusergo netgo static_build' -ldflags '-extldflags "-static"' -o dist/kool-linux-arm7 echo "Going to generate CHECKSUMS" diff --git a/kool.yml b/kool.yml new file mode 100644 index 00000000..675d5109 --- /dev/null +++ b/kool.yml @@ -0,0 +1,16 @@ +scripts: + # Helper for local development - parsing presets onto Go, + # compiling and installig locally + dev: + - kool run parse-presets + - kool run compile + - kool run install + # Parsing the preset files onto Go code in a shell automated fashion. + parse-presets: + - bash parse_presets.sh + # Compiling kool itself. In case you are on MacOS make sure to have your .env + # file properly setting GOOS=darwin so you will be able to use the binary. + compile: + - kool docker golang:1.15.0 go build -o kool + install: + - mv kool /usr/local/bin/kools