Skip to content

Commit

Permalink
.github: generate a simple flowgen container
Browse files Browse the repository at this point in the history
Build and publish a simple flowgen container.
  • Loading branch information
msune committed Apr 19, 2024
1 parent e3eb530 commit cb80d74
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docker-publish-ghcr

on:
workflow_dispatch:
push:
pull_request:

permissions:
packages: write

env:
PLATFORMS: linux/amd64

jobs:
docker_build_and_publish:
runs-on: ubuntu-22.04
steps:
- name: "Checkout netflow-generator"
uses: actions/checkout@v4
with:
path: netflow-generator
fetch-depth: 0
fetch-tags: 1

- name: "Set up Docker buildx"
uses: docker/setup-buildx-action@v3

- name: "Login to GitHub Container Registry (ghcr.io)"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: "Build and push to ghcr"
run: |
#Cross-build
cd netflow-generator
export TAG=$(git describe HEAD | sed 's/-.*$//g')
docker buildx build --platform ${PLATFORMS} --push -f Dockerfile . --tag ghcr.io/${GITHUB_REPOSITORY}:${TAG}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#### Base Image: Debian 12 (Bookworm)
FROM debian:bookworm-slim as builder

RUN apt-get update && apt-get -y install gcc make
COPY * /tmp/
RUN cd tmp && make && ls -la

FROM debian:bookworm-slim
COPY --from=builder /tmp/flowgen /usr/bin/
ENTRYPOINT ["/usr/bin/flowgen"]

0 comments on commit cb80d74

Please sign in to comment.