moved to taskfile, delete container first
This commit is contained in:
parent
44968a38bc
commit
d5342353a9
2 changed files with 2 additions and 52 deletions
|
@ -7,7 +7,6 @@ vars:
|
|||
|
||||
tasks:
|
||||
default:
|
||||
cmd: "echo {{OS}}"
|
||||
deps:
|
||||
- build:go
|
||||
|
||||
|
@ -51,7 +50,7 @@ tasks:
|
|||
clean:
|
||||
cmds:
|
||||
- rm -rf out/
|
||||
- cmd: docker image rm listen-build
|
||||
ignore_error: true
|
||||
- cmd: docker rm listen-build-tmp
|
||||
ignore_error: true
|
||||
- cmd: docker image rm listen-build
|
||||
ignore_error: true
|
||||
|
|
49
build
49
build
|
@ -1,49 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Create all the different builds for listen
|
||||
|
||||
# verify we are at root of repository
|
||||
if ! [ -d .git ]; then
|
||||
echo build: this script must be run at the root of the repo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if uname | grep -qe Linux; then
|
||||
os=linux
|
||||
elif uname | grep -qe MINGW; then
|
||||
os=windows
|
||||
else
|
||||
os=other
|
||||
fi
|
||||
|
||||
build_go() {
|
||||
go build -o out/$(go env GOOS)/listen .
|
||||
}
|
||||
|
||||
build_docker() {
|
||||
if [ $os = "windows" ]; then
|
||||
/c/Program\ Files/Docker/Docker/DockerCli.exe -SwitchWindowsEngine
|
||||
exe=C:/build/listen/listen.exe
|
||||
else
|
||||
exe=/usr/src/listen/listen
|
||||
fi
|
||||
|
||||
if docker build -t listen-build -f docker/build.$os.Dockerfile .; then
|
||||
mkdir -p out/$os
|
||||
docker create --name listen-build-tmp listen-build
|
||||
docker cp listen-build-tmp:$exe out/$os
|
||||
docker rm listen-build-tmp
|
||||
fi
|
||||
}
|
||||
|
||||
# if an arg is specified, force building with the specified method
|
||||
[ $1 ] && (build_$1; exit)
|
||||
|
||||
# prefer building with local go install if it exists on path
|
||||
if which go &> /dev/null; then
|
||||
build_go; exit
|
||||
# if windows or linux, try building with docker
|
||||
elif echo $os | grep -qe linux -e windows; then
|
||||
which docker &> /dev/null && (build_docker; exit)
|
||||
fi
|
||||
|
||||
echo could not find valid build method for OS && exit 2
|
Loading…
Add table
Reference in a new issue