Skip to content

Commit

Permalink
EXAMPLE: makefile instead of taskfile
Browse files Browse the repository at this point in the history
Do not merge. This is an example for @thinkofher.
  • Loading branch information
q3k committed Nov 29, 2020
1 parent 66879ee commit 051818e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 80 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Binaries for programs and plugins
long-season
long-season-cli
embedfiles
*.exe
*.exe~
*.dll
Expand All @@ -21,3 +22,6 @@ long-season.db

# embedded go file
pkg/static/files.gen.go

# vim crap
**swp
18 changes: 3 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ FROM golang:1.15-alpine

WORKDIR $GOPATH/bin

RUN apk add --no-cache git \
&& export GO111MODULE=off \
&& go get 4d63.com/embedfiles \
&& export GO111MODULE=on

RUN apk add --no-cache git make

WORKDIR /opt/db
ENV LS_BOLT_DB /opt/db/bolt.db
Expand All @@ -15,15 +11,7 @@ ENV SRC /go/src/app
WORKDIR $SRC
COPY . .

RUN go get -d -v ./...
RUN embedfiles -out=pkg/static/files.gen.go -pkg=static web


RUN go build -o "long-season" ./cmd/server/main.go \
&& mv "long-season" $GOPATH/bin/

RUN go build -o "long-season-cli" ./cmd/cli/main.go \
&& mv "long-season-cli" $GOPATH/bin/
RUN make build SERVER=$GOPATH/bin/long-season CLI=$GOPATH/bin/long-season-cli

WORKDIR /
RUN rm -rf $SRC $GOPATH/bin/embedfiles
RUN rm -rf $SRC
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SERVER := long-season
CLI := long-season-cli
EMBEDFILES := $(CURDIR)/embedfiles
STATIC := pkg/static/files.gen.go

default: build

$(SERVER): $(STATIC) $(wildcard cmd/server/** pkg/**)
go build -o $@ cmd/server/main.go

$(CLI): $(SERVER) $(wildcard cmd/cli/** pkg/**)
go build -o $@ cmd/cli/main.go

$(EMBEDFILES):
GO111MODULE=off go get 4d63.com/embedfiles
GO111MODULE=off go build -o $@ 4d63.com/embedfiles

$(STATIC): $(EMBEDFILES) $(wildcard web/**)
$(EMBEDFILES) -out=$@ -pkg=static web

.PHONY: default build run clean lint test

build: $(SERVER) $(CLI)

run: $(SERVER)
$(SERVER)

clean:
rm -f $(SERVER) $(CLI) $(EMBEDFILES) $(STATIC)

lint:
golint ./...

test: $(STATIC)
go test ./...
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ Basically: users are adding MAC addresses of their devices to their profile and

## Installing

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

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

$ task
$ make

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.

$ task --watch run
Now you have `long-season` and `long-season-cli` in your root directory.

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

Expand Down
60 changes: 0 additions & 60 deletions Taskfile.yml

This file was deleted.

0 comments on commit 051818e

Please sign in to comment.