-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added container build workflow (#94)
* added container build workflow * remove unneeded env var
- Loading branch information
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
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,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" ] |
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,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 }} |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ on: | |
- reopened | ||
- ready_for_review | ||
- synchronize | ||
workflow_call: | ||
|
||
jobs: | ||
output-unit-tests: | ||
|
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