Skip to content

Commit b648f8c

Browse files
committed
add multiplatform docker from Birli
1 parent ec8e784 commit b648f8c

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed

.github/workflows/docker.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
on: [push, pull_request]
2+
3+
name: Docker Multiplatform
4+
5+
env:
6+
REGISTRY_IMAGE: mwatelescope/birli
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
environment: CI
12+
strategy:
13+
# fail-fast: false
14+
matrix:
15+
platform:
16+
- linux/amd64
17+
# - linux/arm/v6
18+
# - linux/arm/v7
19+
- linux/arm64
20+
steps:
21+
- name: Prepare
22+
run: |
23+
platform=${{ matrix.platform }}
24+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
25+
26+
- name: Docker meta
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ env.REGISTRY_IMAGE }}
31+
32+
- name: Login to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
40+
with:
41+
platforms: ${{ matrix.platform }}
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
with:
46+
platforms: ${{ matrix.platform }}
47+
48+
- name: Build and push by digest
49+
id: build
50+
uses: docker/build-push-action@v6
51+
with:
52+
platforms: ${{ matrix.platform }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
55+
56+
- name: Export digest
57+
run: |
58+
mkdir -p /tmp/digests
59+
digest="${{ steps.build.outputs.digest }}"
60+
touch "/tmp/digests/${digest#sha256:}"
61+
62+
- name: Upload digest
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: digests-${{ env.PLATFORM_PAIR }}
66+
path: /tmp/digests/*
67+
if-no-files-found: error
68+
retention-days: 1
69+
70+
merge:
71+
runs-on: ubuntu-latest
72+
needs:
73+
- build
74+
steps:
75+
- name: Download digests
76+
uses: actions/download-artifact@v4
77+
with:
78+
path: /tmp/digests
79+
pattern: digests-*
80+
merge-multiple: true
81+
82+
- name: Set up Docker Buildx
83+
uses: docker/setup-buildx-action@v3
84+
85+
- name: Docker meta
86+
id: meta
87+
uses: docker/metadata-action@v5
88+
with:
89+
images: ${{ env.REGISTRY_IMAGE }}
90+
91+
- name: Login to Docker Hub
92+
uses: docker/login-action@v3
93+
with:
94+
username: ${{ secrets.DOCKERHUB_USERNAME }}
95+
password: ${{ secrets.DOCKERHUB_TOKEN }}
96+
97+
- name: Create manifest list and push
98+
working-directory: /tmp/digests
99+
run: |
100+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
101+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
102+
103+
- name: Inspect image
104+
run: |
105+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM mwatelescope/birli:latest-python3.11-slim-bookworm
2+
3+
ENV DEBIAN_FRONTEND="noninteractive"
4+
RUN apt-get update -y && \
5+
apt-get -y install \
6+
tzdata \
7+
build-essential \
8+
pkg-config \
9+
cmake \
10+
curl \
11+
git \
12+
lcov \
13+
fontconfig \
14+
libfreetype-dev \
15+
libexpat1-dev \
16+
clang \
17+
libfontconfig-dev \
18+
&& \
19+
apt-get clean all && \
20+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
21+
apt-get -y autoremove
22+
23+
ADD . /hyperdrive
24+
WORKDIR /hyperdrive
25+
26+
ARG TEST_SHIM=""
27+
RUN ${TEST_SHIM}
28+
29+
RUN cargo install --path . --no-default-features --features=plotting --locked \
30+
&& cargo clean

0 commit comments

Comments
 (0)