forked from daptin/daptin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (23 loc) · 849 Bytes
/
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
.PHONY: container publish serve serve-container clean
app := daptin
static-app := build/linux-amd64/$(app)
docker-tag := daptin/daptin
bin/$(app): *.go
go build -o $@
docker: docker-daptin-binary
cd docker_dir && cp ../daptin-linux-amd64 main && docker build -t daptin/daptin . && cd ..
docker-daptin-binary:
rm -rf rice-box.go && rice embed-go && xgo --targets='linux/amd64' -ldflags='-extldflags "-static"' .
$(static-app): *.go
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
go build -ldflags='-extldflags "-static"' -a -installsuffix cgo -o $(static-app)
container: $(static-app)
docker build -t $(docker-tag) .
publish: container
docker push $(docker-tag)
serve: bin/$(app)
env PATH=$(PATH):./bin forego start web
serve-container:
docker run -it --rm --env-file=.env -p 8081:8080 $(docker-tag)
clean:
rm -rf bin build