Skip to content

Commit

Permalink
chore: add docker build and make targets (#19)
Browse files Browse the repository at this point in the history
* chore: add docker build and make targets

- add Dockerfile to build `filecoin/sentinel-visor` docker image
- add .dockerignore to reduce context sent to docker build


License: MIT
Signed-off-by: Oli Evans <[email protected]>
  • Loading branch information
olizilla authored Sep 21, 2020
1 parent 47b1885 commit 4586d9b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.circleci
/.github
/build/*
/extern/filecoin-ffi
/Dockerfile*
/docker-compose*
/sentinel-visor
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Builder
FROM golang:1.15.2 as builder

# Install deps for filecoin-project/filecoin-ffi
RUN apt-get update
RUN apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev

WORKDIR /go/src/github.com/filecoin-project/sentinel-visor
COPY . /go/src/github.com/filecoin-project/sentinel-visor
RUN make deps && make build

# Runner
FROM buildpack-deps:buster-curl
# Grab the things
COPY --from=builder /go/src/github.com/filecoin-project/sentinel-visor/sentinel-visor /usr/bin/
COPY --from=builder /usr/lib/x86_64-linux-gnu/libOpenCL.so* /lib/

ENTRYPOINT ["/usr/bin/sentinel-visor"]
CMD ["--help"]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PG_IMAGE?=postgres:10
REDIS_IMAGE?=redis:6
COMMIT := $(shell git rev-parse --short HEAD)

unexport GOFLAGS

Expand Down Expand Up @@ -70,6 +71,11 @@ sentinel-visor:

BINS+=sentinel-visor

.PHONY: docker-image
docker-image:
docker build -t "filecoin/sentinel-visor" .
docker tag "filecoin/sentinel-visor:latest" "filecoin/sentinel-visor:$(COMMIT)"

clean:
rm -rf $(CLEAN) $(BINS)
-$(MAKE) -C $(FFI_PATH) clean
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus

## Getting Started

Clone the repo and build the dependencies:

```console
$ git clone [email protected]:filecoin-project/sentinel-visor.git
$ cd sentinel-visor
$ make deps
```

Build the `sentinel-visor` binary to the root of the project directory:

```console
$ make build
```

### Usage

```
Expand All @@ -16,6 +30,11 @@ A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus
Use 'sentinel-visor help <command>' to learn more about each command.
```

Use the following env vars to configure the lotus node that visor reads from, and the database that it writes to:

- `LOTUS_PATH` - path to the lotus data dir. _default: `~/.lotus`_
- `LOTUS_DB` - database connection . _default: `postgres://postgres:password@localhost:5432/postgres?sslmode=disable`_

### Configuring Tracing

The global flag `--tracing=<bool>` turns tracing on or off. It is on by default.
Expand Down

0 comments on commit 4586d9b

Please sign in to comment.