Skip to content

Commit 051818e

Browse files
committed
EXAMPLE: makefile instead of taskfile
Do not merge. This is an example for @thinkofher.
1 parent 66879ee commit 051818e

File tree

5 files changed

+45
-80
lines changed

5 files changed

+45
-80
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Binaries for programs and plugins
22
long-season
33
long-season-cli
4+
embedfiles
45
*.exe
56
*.exe~
67
*.dll
@@ -21,3 +22,6 @@ long-season.db
2122

2223
# embedded go file
2324
pkg/static/files.gen.go
25+
26+
# vim crap
27+
**swp

Dockerfile

+3-15
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ FROM golang:1.15-alpine
22

33
WORKDIR $GOPATH/bin
44

5-
RUN apk add --no-cache git \
6-
&& export GO111MODULE=off \
7-
&& go get 4d63.com/embedfiles \
8-
&& export GO111MODULE=on
9-
5+
RUN apk add --no-cache git make
106

117
WORKDIR /opt/db
128
ENV LS_BOLT_DB /opt/db/bolt.db
@@ -15,15 +11,7 @@ ENV SRC /go/src/app
1511
WORKDIR $SRC
1612
COPY . .
1713

18-
RUN go get -d -v ./...
19-
RUN embedfiles -out=pkg/static/files.gen.go -pkg=static web
20-
21-
22-
RUN go build -o "long-season" ./cmd/server/main.go \
23-
&& mv "long-season" $GOPATH/bin/
24-
25-
RUN go build -o "long-season-cli" ./cmd/cli/main.go \
26-
&& mv "long-season-cli" $GOPATH/bin/
14+
RUN make build SERVER=$GOPATH/bin/long-season CLI=$GOPATH/bin/long-season-cli
2715

2816
WORKDIR /
29-
RUN rm -rf $SRC $GOPATH/bin/embedfiles
17+
RUN rm -rf $SRC

Makefile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
SERVER := long-season
2+
CLI := long-season-cli
3+
EMBEDFILES := $(CURDIR)/embedfiles
4+
STATIC := pkg/static/files.gen.go
5+
6+
default: build
7+
8+
$(SERVER): $(STATIC) $(wildcard cmd/server/** pkg/**)
9+
go build -o $@ cmd/server/main.go
10+
11+
$(CLI): $(SERVER) $(wildcard cmd/cli/** pkg/**)
12+
go build -o $@ cmd/cli/main.go
13+
14+
$(EMBEDFILES):
15+
GO111MODULE=off go get 4d63.com/embedfiles
16+
GO111MODULE=off go build -o $@ 4d63.com/embedfiles
17+
18+
$(STATIC): $(EMBEDFILES) $(wildcard web/**)
19+
$(EMBEDFILES) -out=$@ -pkg=static web
20+
21+
.PHONY: default build run clean lint test
22+
23+
build: $(SERVER) $(CLI)
24+
25+
run: $(SERVER)
26+
$(SERVER)
27+
28+
clean:
29+
rm -f $(SERVER) $(CLI) $(EMBEDFILES) $(STATIC)
30+
31+
lint:
32+
golint ./...
33+
34+
test: $(STATIC)
35+
go test ./...

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ Basically: users are adding MAC addresses of their devices to their profile and
1717

1818
## Installing
1919

20-
Right now you have to build `long-season` manually. But you can facilitate your work by using a [task](https://taskfile.dev).
20+
Right now you have to build `long-season` manually. But you can facilitate your work by using our Makefile.
2121

2222
Clone this repository and enter below command in your shell (or whatever you are using):
2323

24-
$ task
24+
$ make
2525

26-
Now you have `long-season` and `long-season-cli` in your root directory. You can use `task` for running project and rebuilding it whenever some changes occurs.
27-
28-
$ task --watch run
26+
Now you have `long-season` and `long-season-cli` in your root directory.
2927

3028
You can also build docker image or just use `docker-compose`, which is the simplest way to start development or use `long-season`.
3129

Taskfile.yml

-60
This file was deleted.

0 commit comments

Comments
 (0)