Neale Pickett
·
2023-12-06
build.sh
1#! /bin/sh
2
3set -e
4
5cd $(dirname $0)
6base=../..
7
8VERSION=$(cat $base/CHANGELOG.md | awk -F '[][]' '/^## \[/ {print $2; exit}')
9GO_VERSION=$(cat $base/go.mod | sed -n 's/^go //p')
10
11(
12 zipfile=winmoth.$VERSION.zip
13 echo "=== Building $zipfile"
14 mkdir -p winmoth winmoth/state winmoth/puzzles winmoth/mothballs
15 echo devel > winmoth/state/teamids.txt
16 cp moth-devel.bat winmoth
17 cp -a $base/theme winmoth
18 (
19 cd winmoth
20 GOOS=windows GOARCH=amd64 go build ../$base/cmd/mothd/...
21 )
22 zip -r $zipfile winmoth
23
24 rm -rf winmoth
25)
26
27tag=dirtbags/moth:$VERSION
28echo "==== Building $tag"
29docker build \
30 --build-arg GO_VERSION=$GO_VERSION \
31 --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy \
32 --tag $tag \
33 -f Containerfile $base
34
35exit 0