general: build docker images with correct arch label

This commit is contained in:
Lan Tian
2022-01-09 01:45:00 -06:00
parent e7f6026854
commit f60a292129
10 changed files with 242 additions and 257 deletions

View File

@@ -9,7 +9,7 @@ An alternative implementation for [bird-lg](https://github.com/sileht/bird-lg) w
- [Bird-lg-go](#bird-lg-go)
- [Table of Contents](#table-of-contents)
- [Build Instructions](#build-instructions)
- [Build Docker Images](#build-docker-images)
- [Build Docker Images](#build-docker-images)
- [Frontend](#frontend)
- [Proxy](#proxy)
- [Advanced Features](#advanced-features)
@@ -17,8 +17,6 @@ An alternative implementation for [bird-lg](https://github.com/sileht/bird-lg) w
- [IP addresses](#ip-addresses)
- [API](#api)
- [Telegram Bot Webhook](#telegram-bot-webhook)
- [Example of setting the webhook](#example-of-setting-the-webhook)
- [Supported commands](#supported-commands)
- [Credits](#credits)
- [License](#license)
@@ -28,40 +26,11 @@ You need to have **Go 1.16 or newer** installed on your machine.
Run `make` to build binaries for both the frontend and the proxy.
Optionally run `make install` to install them to `/usr/local/bin`.
Optionally run `make install` to install them to `/usr/local/bin` (`bird-lg-go` and `bird-lgproxy-go`).
Or, you can manually do the building steps:
### Build Docker Images
```bash
# Build frontend binary
cd frontend
go build -ldflags "-w -s" -o frontend
cd ..
# Build proxy binary
cd proxy
go build -ldflags "-w -s" -o proxy
cd ..
```
## Build Docker Images
Run `make dockerfile` and you'll get a bunch of Dockerfiles for different architectures:
- `frontend/Dockerfile.amd64`
- `frontend/Dockerfile.arm32v7`
- `frontend/Dockerfile.arm64v8`
- `frontend/Dockerfile.i386`
- `frontend/Dockerfile.ppc64le`
- `frontend/Dockerfile.s390x`
- `proxy/Dockerfile.amd64`
- `proxy/Dockerfile.arm32v7`
- `proxy/Dockerfile.arm64v8`
- `proxy/Dockerfile.i386`
- `proxy/Dockerfile.ppc64le`
- `proxy/Dockerfile.s390x`
`cd` into either frontend or proxy directory, rename the Dockerfile for your architecture to `Dockerfile` and run `docker build .` as usual. In most cases you'll want `Dockerfile.amd64`.
Use the Dockerfiles in `frontend` and `proxy` directory.
## Frontend
@@ -194,30 +163,13 @@ These three servers are displayed as "Prod", "Test1" and "Test2" in the user int
The frontend provides an API for running BIRD/traceroute/whois queries.
See [API docs](API.md) for detailed information.
See [API docs](docs/API.md) for detailed information.
### Telegram Bot Webhook
The frontend can act as a Telegram Bot webhook endpoint, to add BGP route/traceroute/whois lookup functionality to your tech group.
There is no configuration necessary on the frontend, just start it up normally.
Set your Telegram Bot webhook URL to `https://your.frontend.com/telegram/alpha+beta+gamma`, where `alpha+beta+gamma` is the list of servers to be queried on Telegram commands, separated by `+`.
You may omit `alpha+beta+gamma` to use all your servers, but it is not recommended when you have lots of servers, or the message would be too long and hard to read.
#### Example of setting the webhook
```bash
curl "https://api.telegram.org/bot${BOT_TOKEN}/setWebhook?url=https://your.frontend.com:5000/telegram/alpha+beta+gamma"
```
#### Supported commands
- `path`: Show bird's ASN path to target IP
- `route`: Show bird's preferred route to target IP
- `trace`: Traceroute to target IP/domain
- `whois`: Whois query
See [Telegram docs](docs/Telegram.md) for detailed information.
## Credits