Skip to content
Merged
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
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ CP := cp
MAKE := make
DOCKER_TOOLS = docker run -v $$(pwd):/build lndmon-tools

DOCKER_IMAGE := lndmon
# Derive the tag from the current commit, appending "-dirty" if the working
# tree has uncommitted changes. --match='__no_such_tag__' forces git to ignore
# all tags and fall back to the short commit hash via --always.
DOCKER_COMMIT := $(shell git describe --always --dirty --match='__no_such_tag__')
DOCKER_TAG := $(DOCKER_COMMIT)

LINT = $(LINT_BIN) run -v

default: build
Expand All @@ -43,6 +50,16 @@ build:
# =========
# UTILITIES
# =========
docker-build:
@$(call print, "Building lndmon docker image.")
docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) .

docker-push:
@$(call print, "Pushing lndmon docker image.")
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)

docker-build-push: docker-build docker-push

docker-tools:
@$(call print, "Building tools docker image.")
docker build -q -t lndmon-tools $(TOOLS_DIR)
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ cd lndmon/cmd/lndmon
go build
```

### Makefile commands

The repository ships with a `Makefile` that wraps the most common development
tasks. Run `make list` to print all available targets, or use one of the
commands below:

| Command | Description |
| --- | --- |
| `make build` | Build the `lndmon` binary. |
| `make docker-build` | Build the `lndmon` Docker image. The tag is derived from the current commit (e.g. `lndmon:<commit>`), with a `-dirty` suffix when the working tree has uncommitted changes. Override with `DOCKER_IMAGE`/`DOCKER_TAG`, e.g. `make docker-build DOCKER_TAG=latest`. |
| `make docker-push` | Push the `lndmon` Docker image (uses the same `DOCKER_IMAGE`/`DOCKER_TAG` as `docker-build`; set `DOCKER_IMAGE` to a registry path to push elsewhere). |
| `make docker-build-push` | Build and then push the `lndmon` Docker image in one step. |
| `make docker-tools` | Build the `lndmon-tools` Docker image used for linting. |
| `make fmt` | Fix imports and format the source. |
| `make lint` | Run the linters (uses the tools Docker image). |
| `make clean` | Remove the built `lndmon` binary. |
| `make list` | List all available `make` targets. |

## Options

```
Expand Down
Loading