Skip to content

Commit

Permalink
Merge pull request #27 from kool-dev/go-1.15
Browse files Browse the repository at this point in the history
updates to adopt kool using Go 1.15
  • Loading branch information
dbpolito authored Aug 17, 2020
2 parents d30669e + 5a971ce commit d96262b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/kool
/dist/
/.env

# IDE
.vscode/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 0 additions & 7 deletions build.sh

This file was deleted.

14 changes: 10 additions & 4 deletions build_artifacts.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
16 changes: 16 additions & 0 deletions kool.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d96262b

Please sign in to comment.