Skip to content

Commit

Permalink
Add container image (#95)
Browse files Browse the repository at this point in the history
* Add ubuntu based dockerfile

* Add job to build and upload container image

* Set github token for CLI

* Add checkout action

* Fix wheel filename

* Setup QEMU

* Remove timezone

* Rename publish workflow
  • Loading branch information
SRv6d authored Jul 21, 2024
1 parent 8394dd1 commit 4e1f1de
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ permissions:
id-token: write
attestations: write
contents: write
packages: write

env:
COLUMNS: 120
Expand All @@ -31,3 +32,50 @@ jobs:
dist/anycastd-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-container-image:
needs: build-wheels
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- name: Container Registry Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Download Release Wheel
run: gh release download ${GITHUB_REF_NAME} --pattern '*.whl'
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Build & Push Image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm/v7,linux/arm64

- name: Attest Build Provenance
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: PyPI Publish
name: Publish

on:
release:
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:noble

LABEL org.opencontainers.image.title="anycastd"
LABEL org.opencontainers.image.vendor="WIIT AG <[email protected]>"

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y \
python3 \
python3-venv \
frr \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY anycastd-*.whl .
RUN python3 -m venv venv \
&& venv/bin/python3 -m pip install anycastd-*.whl

ENV LOG_LEVEL=info
ENV LOG_FORMAT=json

ENTRYPOINT ["venv/bin/python3", "-m", "anycastd", "run"]

0 comments on commit 4e1f1de

Please sign in to comment.