forked from xddxdd/bird-lg-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/xddxdd/bird-lg-go
- Loading branch information
Showing
40 changed files
with
4,519 additions
and
581 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
go-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Run frontend unit test | ||
run: | | ||
export GO111MODULE=on | ||
cd frontend | ||
go get -v -t -d ./... | ||
go test -v ./... | ||
cd .. | ||
- name: Run proxy unit test | ||
run: | | ||
export GO111MODULE=on | ||
cd proxy | ||
go get -v -t -d ./... | ||
go test -v ./... | ||
cd .. | ||
docker-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Test whois binary in frontend image | ||
run: | | ||
docker build -t local/frontend frontend/ | ||
docker run --rm --net host --entrypoint whois local/frontend github.com || exit 1 | ||
docker run --rm --net host --entrypoint whois local/frontend -h whois.ripe.net github.com || exit 1 | ||
docker run --rm --net host --entrypoint whois local/frontend -h whois.ripe.net:43 github.com || exit 1 | ||
- name: Test traceroute binary in proxy image | ||
run: | | ||
docker build -t local/proxy proxy/ | ||
docker run --rm --net host --entrypoint traceroute local/proxy 127.0.0.1 || exit 1 | ||
docker run --rm --net host --entrypoint traceroute local/proxy ::1 || exit 1 | ||
docker-develop: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- go-test | ||
- docker-test | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build frontend docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: '{{defaultContext}}:frontend' | ||
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 | ||
push: true | ||
tags: | | ||
xddxdd/bird-lg-go:develop | ||
xddxdd/bird-lg-go:develop-${{ github.sha }} | ||
ghcr.io/xddxdd/bird-lg-go:frontend-develop | ||
ghcr.io/xddxdd/bird-lg-go:frontend-develop-${{ github.sha }} | ||
- name: Build proxy docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: '{{defaultContext}}:proxy' | ||
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 | ||
push: true | ||
tags: | | ||
xddxdd/bird-lgproxy-go:develop | ||
xddxdd/bird-lgproxy-go:develop-${{ github.sha }} | ||
ghcr.io/xddxdd/bird-lg-go:proxy-develop | ||
ghcr.io/xddxdd/bird-lg-go:proxy-develop-${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1.2.0 | ||
v1.3.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
FROM golang:buster AS step_0 | ||
FROM golang AS step_0 | ||
ENV CGO_ENABLED=0 GO111MODULE=on | ||
WORKDIR /root | ||
COPY . . | ||
RUN go build -ldflags "-w -s" -o /frontend | ||
|
||
################################################################################ | ||
|
||
FROM scratch AS step_1 | ||
FROM alpine:edge AS step_1 | ||
|
||
WORKDIR /root | ||
RUN apk add --no-cache build-base pkgconf perl gettext \ | ||
libidn2-dev libidn2-static libunistring-dev libunistring-static gnu-libiconv-dev | ||
|
||
RUN wget https://github.com/rfc1036/whois/archive/refs/tags/v5.5.18.tar.gz \ | ||
-O whois-5.5.18.tar.gz | ||
|
||
RUN tar xvf whois-5.5.18.tar.gz \ | ||
&& cd whois-5.5.18 \ | ||
&& sed -i "s/#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L/#if 1/g" config.h \ | ||
&& make whois -j4 \ | ||
LDFLAGS="-static" CONFIG_FILE="/etc/whois.conf" PKG_CONFIG="pkg-config --static" HAVE_ICONV=1 \ | ||
&& strip /root/whois-5.5.18/whois | ||
|
||
################################################################################ | ||
|
||
FROM scratch AS step_2 | ||
ENV PATH=/ | ||
ENV BIRDLG_WHOIS=/whois | ||
COPY --from=step_0 /frontend / | ||
COPY --from=step_1 /root/whois-5.5.18/whois / | ||
COPY --from=step_1 /etc/services /etc/services | ||
ENTRYPOINT ["/frontend"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.