Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
feat(docker): Add docker image rule
Browse files Browse the repository at this point in the history
Add docker image support for easier installation. User can now use bazel
rules to build a docker image. The image is also uploaded to docker hub
for faster deployment with default settings.
  • Loading branch information
Yu Wei Wu committed Mar 20, 2019
1 parent 0668526 commit 67b0547
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ Before running tangle-accelerator, please edit binding address/port of accelerat
$ make && bazel run //accelerator
```

### Build from docker

If you prefer building a docker image, tangle-accelerator also provides build rules for it. Note that you still have to edit configurations in `accelerator/config.h`.

```
$ make && bazel run //accelerator:ta_image
```

There's also an easier option to pull image from docker hub then simply run with default configs. Please do remember a redis-server is still required in this way.

```
$ docker run -d --net=host --name tangle-accelerator wusyong/tangel-accelerator:latest
```

## Developing

The codebase of this repository follows [Google's C++ guidelines](https://google.github.io/styleguide/cppguide.html):
Expand Down
9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ git_repository(
remote = "https://github.com/meltwater/served.git",
)

git_repository(
name = "io_bazel_rules_docker",
remote = "https://github.com/bazelbuild/rules_docker.git",
tag = "v0.6.0",
)

load("@rules_iota//:defs.bzl", "iota_deps")
load("@io_bazel_rules_docker//cc:image.bzl", _cc_image_repos = "repositories")

iota_deps()

_cc_image_repos()
7 changes: 7 additions & 0 deletions accelerator/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_docker//cc:image.bzl", "cc_image")

cc_binary(
name = "accelerator",
srcs = ["server.cc"],
Expand All @@ -11,6 +13,11 @@ cc_binary(
],
)

cc_image(
name = "ta_image",
binary = ":accelerator",
)

cc_library(
name = "apis",
srcs = ["apis.c"],
Expand Down

0 comments on commit 67b0547

Please sign in to comment.