-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (32 loc) · 1.46 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# cross compile cmd/witty/witty for Linux and MacOs (golang)
.PHONY :cross-compile
cross-compile:
@echo "cross compiling cmd/witty/witty for Linux,MacOs and FreeBSD"
mkdir -p build/witty-linux-amd64
mkdir -p build/witty-darwin-amd64
mkdir -p build-witty-darwing-arm64
mkdir -p build/witty-freebsd-amd64
GOOS=linux GOARCH=amd64 go build -o build/witty-linux-amd64/witty ./cmd/witty
GOOS=darwin GOARCH=amd64 go build -o build/witty-darwin-amd64/witty ./cmd/witty
GOOS=darwin GOARCH=arm64 go build -o build/witty-darwin-arm64/witty ./cmd/witty
GOOS=freebsd GOARCH=amd64 go build -o build/witty-freebsd-amd64/witty ./cmd/witty
# zip binaries
.PHONY :zip
zip:
@echo "zipping binaries"
cd build && zip -r witty-linux-amd64.zip witty-linux-amd64 \
&& zip -r witty-darwin-amd64.zip witty-darwin-amd64 \
&& zip -r witty-darwin-arm64.zip witty-darwin-arm64 \
&& zip -r witty-freebsd-amd64.zip witty-freebsd-amd64
# get the current directory
pwd:=${PWD}
# run witty on Linux using Docker, inheriting the environment variable OPENAPI_API_KEY
.PHONY :run-witty-linux
run-witty-linux: build-witty-linux-run
@echo "running witty on Linux"
docker run -it --rm -v ${pwd}/build/witty-linux-amd64:/witty -e OPENAPI_API_KEY=${OPENAPI_API_KEY} witty-linux-run bash -c 'cd /witty && ./witty'
# build the witty-linux-run image from the docker directory
.PHONY :build-witty-linux-run
build-witty-linux-run:
@echo "building witty-linux-run image"
cd docker && docker build -t witty-linux-run .