Skip to content

Commit

Permalink
Merge pull request #6359 from onflow/vishal/binary_for_an
Browse files Browse the repository at this point in the history
adding a new target in the Makefile to generate a binary for the access node
  • Loading branch information
vishalchangrani authored Aug 22, 2024
2 parents 8b4fff2 + 41aeabf commit 1909c35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ docker-native-build-access-corrupt:
-t "$(CONTAINER_REGISTRY)/access-corrupted:$(IMAGE_TAG)" .
./insecure/cmd/mods_restore.sh

# build a binary to run on bare metal without using docker.
# binary is written to file ./bin/app
.PHONY: docker-native-build-access-binary
docker-native-build-access-binary: docker-native-build-access
docker create --name extract "$(CONTAINER_REGISTRY)/access:latest"
docker cp extract:/bin/app ./flow_access_node
docker rm extract

.PHONY: docker-native-build-observer
docker-native-build-observer:
docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ Build a Docker image for a particular node role (replace `$ROLE` with `collectio
make docker-native-build-$ROLE
```

#### Building a binary for the access node

Build the binary for an access node that can be run directly on the machine without using Docker.

```bash
make docker-native-build-access-binary
```
_this builds a binary for Linux/x86_64 machine_.

The make command will generate a binary called `flow_access_node`

### Importing the module

When importing the `github.com/onflow/flow-go` module in your Go project, testing or building your project may require setting extra Go flags because the module requires [cgo](https://pkg.go.dev/cmd/cgo). In particular, `CGO_ENABLED` must be set to `1` if `cgo` isn't enabled by default. This constraint comes from the underlying cryptography library. Refer to the [crypto repository build](https://github.com/onflow/crypto?tab=readme-ov-file#build) for more details.
Expand Down

0 comments on commit 1909c35

Please sign in to comment.