Skip to content

Commit 4e1f1de

Browse files
authored
Add container image (#95)
* 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
1 parent 8394dd1 commit 4e1f1de

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

.github/workflows/build.yml

+48
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions:
99
id-token: write
1010
attestations: write
1111
contents: write
12+
packages: write
1213

1314
env:
1415
COLUMNS: 120
@@ -31,3 +32,50 @@ jobs:
3132
dist/anycastd-*
3233
env:
3334
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
build-container-image:
36+
needs: build-wheels
37+
runs-on: ubuntu-latest
38+
env:
39+
REGISTRY: ghcr.io
40+
IMAGE_NAME: ${{ github.repository }}
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- uses: docker/setup-qemu-action@v3
45+
46+
- uses: docker/setup-buildx-action@v3
47+
48+
- name: Container Registry Login
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ${{ env.REGISTRY }}
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Extract Metadata (tags, labels)
56+
id: meta
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60+
61+
- name: Download Release Wheel
62+
run: gh release download ${GITHUB_REF_NAME} --pattern '*.whl'
63+
env:
64+
GITHUB_TOKEN: ${{ github.token }}
65+
66+
- name: Build & Push Image
67+
id: push
68+
uses: docker/build-push-action@v6
69+
with:
70+
context: .
71+
push: true
72+
tags: ${{ steps.meta.outputs.tags }}
73+
labels: ${{ steps.meta.outputs.labels }}
74+
platforms: linux/amd64,linux/arm/v7,linux/arm64
75+
76+
- name: Attest Build Provenance
77+
uses: actions/attest-build-provenance@v1
78+
with:
79+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
80+
subject-digest: ${{ steps.push.outputs.digest }}
81+
push-to-registry: true

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: PyPI Publish
2+
name: Publish
33

44
on:
55
release:

Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:noble
2+
3+
LABEL org.opencontainers.image.title="anycastd"
4+
LABEL org.opencontainers.image.vendor="WIIT AG <[email protected]>"
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update && apt-get install --no-install-recommends -y \
9+
python3 \
10+
python3-venv \
11+
frr \
12+
&& apt-get clean \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
WORKDIR /app
16+
17+
COPY anycastd-*.whl .
18+
RUN python3 -m venv venv \
19+
&& venv/bin/python3 -m pip install anycastd-*.whl
20+
21+
ENV LOG_LEVEL=info
22+
ENV LOG_FORMAT=json
23+
24+
ENTRYPOINT ["venv/bin/python3", "-m", "anycastd", "run"]

0 commit comments

Comments
 (0)