Skip to content

Commit c91ccd2

Browse files
committed
wip
1 parent 3f3b3aa commit c91ccd2

File tree

4 files changed

+145
-18
lines changed

4 files changed

+145
-18
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: build
22
on:
3-
push:
4-
paths-ignore:
5-
- "image/**"
6-
- "**.md"
73
workflow_dispatch: {} # manual trigger
84
env:
95
RUST_LOG: "debug"

.github/workflows/release_test.yaml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: release_test
2+
on:
3+
push: {}
4+
env:
5+
REGISTRY_IMAGE: ghcr.io/kamu-data/engine-datafusion
6+
IMAGE_LABELS: |
7+
org.opencontainers.image.title=MyCustomTitle
8+
org.opencontainers.image.description=Another description
9+
org.opencontainers.image.vendor=Kamu Data Inc.
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- runs-on: ubuntu-latest
17+
target: x86_64-unknown-linux-musl
18+
platform: linux/amd64
19+
qemu: false
20+
- runs-on: ubuntu-latest
21+
target: aarch64-unknown-linux-musl
22+
platform: linux/arm64
23+
qemu: true
24+
name: Build
25+
runs-on: ${{ matrix.runs-on }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
# Collects metadata about build for image labels
30+
- name: Docker meta
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY_IMAGE }}
35+
# TODOOOOOOOOOOO
36+
tags: |
37+
# use custom value instead of git tag
38+
type=semver,pattern={{version}},value=v0.7.2
39+
labels: ${{ env.IMAGE_LABELS }}
40+
41+
- name: Set up QEMU
42+
if: matrix.qemu
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- uses: actions-rs/toolchain@v1
49+
with:
50+
target: ${{ matrix.target }}
51+
override: true
52+
53+
- name: Install cross
54+
run: cargo install cross --locked
55+
56+
- name: Build binary
57+
run: make build TARGET_ARCH=${{ matrix.target }}
58+
59+
- name: Log in to GitHub Container Registry
60+
uses: docker/login-action@v3
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.actor }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
66+
# See: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
67+
- name: Build and push by digest
68+
id: build
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
file: image/Dockerfile
73+
platforms: ${{ matrix.platform }}
74+
# TODOOOOOOOOOOOOOOOOO
75+
build-args: |
76+
target_arch=${{ matrix.target }}
77+
version=0.7.2
78+
labels: ${{ steps.meta.outputs.labels }}
79+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
80+
81+
- name: Export digest
82+
run: |
83+
mkdir -p /tmp/digests
84+
digest="${{ steps.build.outputs.digest }}"
85+
touch "/tmp/digests/${digest#sha256:}"
86+
87+
- name: Prepare upload digest
88+
run: |
89+
platform=${{ matrix.platform }}
90+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
91+
92+
- name: Upload digest
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: digests-${{ env.PLATFORM_PAIR }}
96+
path: /tmp/digests/*
97+
if-no-files-found: error
98+
retention-days: 1
99+
100+
merge:
101+
runs-on: ubuntu-latest
102+
needs:
103+
- build
104+
steps:
105+
- name: Download digests
106+
uses: actions/download-artifact@v4
107+
with:
108+
path: /tmp/digests
109+
pattern: digests-*
110+
merge-multiple: true
111+
112+
- name: Set up Docker Buildx
113+
uses: docker/setup-buildx-action@v3
114+
115+
- name: Docker meta
116+
id: meta
117+
uses: docker/metadata-action@v5
118+
with:
119+
images: ${{ env.REGISTRY_IMAGE }}
120+
# TODOOOOOOOOOOO
121+
tags: |
122+
# use custom value instead of git tag
123+
type=semver,pattern={{version}},value=v0.7.2
124+
labels: ${{ env.IMAGE_LABELS }}
125+
126+
- name: Log in to GitHub Container Registry
127+
uses: docker/login-action@v3
128+
with:
129+
registry: ghcr.io
130+
username: ${{ github.actor }}
131+
password: ${{ secrets.GITHUB_TOKEN }}
132+
133+
- name: Create manifest list and push
134+
working-directory: /tmp/digests
135+
run: |
136+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
137+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
138+
139+
- name: Inspect image
140+
run: |
141+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
TARGET_ARCH = x86_64-unknown-linux-musl
2-
IMAGE_PLATFORM = linux/amd64
2+
PLATFORM = linux/amd64
33
CRATE_VERSION = $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select( .name == "kamu-engine-datafusion") | .version')
44
IMAGE_TAG = $(CRATE_VERSION)
55
IMAGE = ghcr.io/kamu-data/engine-datafusion:$(IMAGE_TAG)
@@ -35,12 +35,12 @@ build:
3535

3636
.PHONY: image
3737
image:
38-
docker build \
39-
--platform $(IMAGE_PLATFORM) \
38+
docker buildx build \
39+
--platform $(PLATFORM) \
4040
--build-arg target_arch=$(TARGET_ARCH) \
41-
--build-arg version=$(CRATE_VERSION) \
4241
-t $(IMAGE) \
4342
-f image/Dockerfile \
43+
--load \
4444
.
4545

4646

image/Dockerfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
# TODO: Consider using https://github.com/GoogleContainerTools/distroless
22
FROM docker.io/library/alpine:3.19
33
ARG target_arch
4-
ARG version
5-
LABEL name="Apache Arrow Datafusion ODF Engine" \
6-
maintainer="[email protected]" \
7-
vendor="Kamu Data Inc." \
8-
summary="Open Data Fabric Engine implementation using the Apache Arrow DataFusion framework" \
9-
description="" \
10-
version=${version}
11-
124

135
# Tini
146
RUN apk add --no-cache tini
157

16-
178
# Engine
189
COPY target/${target_arch}/release/kamu-engine-datafusion /opt/engine/bin/kamu-engine-datafusion
1910

20-
2111
ENV RUST_BACKTRACE=1
2212
ENV RUST_LOG=debug
2313
EXPOSE 2884/tcp

0 commit comments

Comments
 (0)