mirror of
https://github.com/bgp/bgpq4
synced 2025-02-28 08:53:11 +00:00
Added container build workflow (#94)
* added container build workflow * remove unneeded env var
This commit is contained in:
24
.github/images/alpine:3.Dockerfile
vendored
Normal file
24
.github/images/alpine:3.Dockerfile
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# to build the image locally tagged with the short commit hash:
|
||||||
|
# docker build -t bgpq4:$(git rev-parse --short HEAD) -f .github/images/alpine:3.Dockerfile .
|
||||||
|
ARG IMAGE=alpine:3
|
||||||
|
FROM $IMAGE as builder
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apk upgrade
|
||||||
|
RUN apk add autoconf automake file gcc gzip libtool make musl-dev
|
||||||
|
|
||||||
|
# Add source code
|
||||||
|
ADD . /src
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Run steps
|
||||||
|
RUN ./bootstrap
|
||||||
|
RUN ./configure
|
||||||
|
RUN make
|
||||||
|
RUN make check
|
||||||
|
RUN make distcheck
|
||||||
|
|
||||||
|
FROM alpine:3
|
||||||
|
COPY --from=builder /src/bgpq4 /bgp/
|
||||||
|
WORKDIR /bgp
|
||||||
|
ENTRYPOINT [ "./bgpq4" ]
|
||||||
64
.github/workflows/build-container.yml
vendored
Normal file
64
.github/workflows/build-container.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
name: Container build
|
||||||
|
"on":
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*" # Push events to any tag
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Container tag to use for the build"
|
||||||
|
required: true
|
||||||
|
default: "test"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
uses: ./.github/workflows/unit-tests.yml
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build container
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: test
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- # Add support for more platforms with QEMU
|
||||||
|
# https://github.com/docker/setup-qemu-action
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository_owner }}/bgpq4
|
||||||
|
tags: |
|
||||||
|
# pick up tag provided from workflow_dispatch user's input
|
||||||
|
type=raw,value=${{ inputs.tag }}
|
||||||
|
type=ref,event=tag
|
||||||
|
type=ref,event=branch
|
||||||
|
# git short commit
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
- 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 and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: .github/images/alpine:3.Dockerfile
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
1
.github/workflows/unit-tests.yml
vendored
1
.github/workflows/unit-tests.yml
vendored
@@ -8,6 +8,7 @@ on:
|
|||||||
- reopened
|
- reopened
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
- synchronize
|
- synchronize
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
output-unit-tests:
|
output-unit-tests:
|
||||||
|
|||||||
25
README.md
25
README.md
@@ -447,6 +447,31 @@ Linux can be tuned in the following way:
|
|||||||
|
|
||||||
sysctl -w net.ipv4.tcp_wmem="4096 65536 2097152"
|
sysctl -w net.ipv4.tcp_wmem="4096 65536 2097152"
|
||||||
|
|
||||||
|
# CONTAINER IMAGE
|
||||||
|
|
||||||
|
A multi-arch (linux/amd64 and linux/arm64) container image is built automatically for all tagged releases and `main` branch. The image is based on Alpine Linux and is available on [GitHub Container Registry](https://github.com/bgp/bgpq4/pkgs/container/bgpq4).
|
||||||
|
|
||||||
|
Using the image is as simple as:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run --rm ghcr.io/bgp/bgpq4:latest -Jl eltel AS20597
|
||||||
|
policy-options {
|
||||||
|
replace:
|
||||||
|
prefix-list eltel {
|
||||||
|
81.9.0.0/20;
|
||||||
|
81.9.32.0/20;
|
||||||
|
81.9.96.0/20;
|
||||||
|
81.222.128.0/20;
|
||||||
|
81.222.160.0/20;
|
||||||
|
81.222.192.0/18;
|
||||||
|
85.249.8.0/21;
|
||||||
|
85.249.224.0/19;
|
||||||
|
89.112.0.0/17;
|
||||||
|
217.170.64.0/19;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
# BUILDING
|
# BUILDING
|
||||||
|
|
||||||
This project uses autotools. If you are building from the repository,
|
This project uses autotools. If you are building from the repository,
|
||||||
|
|||||||
Reference in New Issue
Block a user