Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXAMPLE: makefile instead of taskfile #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 := $(CURDIR)/long-season
CLI := $(CURDIR)/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.