Skip to content

Commit e68495e

Browse files
authored
Add multi-arch journal image publishing (#17)
- publish journal-sdk for linux/amd64 and linux/arm64 on main - keep PR Docker validation on linux/amd64 for faster feedback - add a localized CUSTOM_SETUP Docker build hook in the Dockerfile - bump journal-sdk to 1.1.1
1 parent aca9111 commit e68495e

4 files changed

Lines changed: 49 additions & 9 deletions

File tree

.github/workflows/all.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,31 @@ jobs:
4949
registry: ghcr.io
5050
username: ${{ github.actor }}
5151
password: ${{ secrets.GITHUB_TOKEN }}
52-
- name: Build Docker images
53-
run: |
54-
docker build . --tag ghcr.io/${{ github.repository }}/journal-sdk:latest
55-
docker build . --tag ghcr.io/${{ github.repository }}/journal-sdk:$( cargo pkgid | cut -d '@' -f 2 )
56-
- name: Push Docker images
52+
- name: Resolve package version
53+
id: version
54+
run: echo "value=$(cargo pkgid | cut -d '@' -f 2)" >> "$GITHUB_OUTPUT"
55+
- name: Setup QEMU
56+
uses: docker/setup-qemu-action@v3
57+
- name: Setup Buildx
58+
uses: docker/setup-buildx-action@v3
59+
- name: Build Docker image (PR/non-main validation)
60+
if: github.ref != 'refs/heads/main'
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: .
64+
platforms: linux/amd64
65+
push: false
66+
load: false
67+
tags: ghcr.io/${{ github.repository }}/journal-sdk:ci
68+
- name: Build and push multi-arch Docker images
5769
if: github.ref == 'refs/heads/main'
58-
run: |
59-
docker push ghcr.io/${{ github.repository }}/journal-sdk:latest
60-
docker push ghcr.io/${{ github.repository }}/journal-sdk:$( cargo pkgid | cut -d '@' -f 2 )
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: .
73+
platforms: linux/amd64,linux/arm64
74+
push: true
75+
tags: |
76+
ghcr.io/${{ github.repository }}/journal-sdk:latest
77+
ghcr.io/${{ github.repository }}/journal-sdk:${{ steps.version.outputs.value }}
78+
labels: |
79+
org.opencontainers.image.source=https://github.com/${{ github.repository }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ target
22
Cargo.lock
33
db/
44
.aider*
5+
6+
custom-setup.sh

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "journal-sdk"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@
33
FROM alpine:3.23.3 AS builder
44

55
ARG RUST_LOG=info
6+
ARG CUSTOM_SETUP=""
67

78
ENV RUST_LOG=${RUST_LOG}
89
ENV CC=clang
910
ENV CXX=clang++
1011

12+
RUN set -eu; \
13+
if [ -n "$CUSTOM_SETUP" ]; then \
14+
echo "$CUSTOM_SETUP" | base64 -d > /tmp/custom-setup.sh; \
15+
chmod +x /tmp/custom-setup.sh; \
16+
/bin/sh -eu /tmp/custom-setup.sh; \
17+
rm -f /tmp/custom-setup.sh; \
18+
fi
19+
1120
# Install OS dependencies
1221
RUN apk update
1322
RUN apk add cargo
@@ -27,6 +36,16 @@ RUN cargo build --release
2736
FROM alpine:3.23.3
2837

2938
WORKDIR /srv
39+
ARG CUSTOM_SETUP=""
40+
41+
RUN set -eu; \
42+
if [ -n "$CUSTOM_SETUP" ]; then \
43+
echo "$CUSTOM_SETUP" | base64 -d > /tmp/custom-setup.sh; \
44+
chmod +x /tmp/custom-setup.sh; \
45+
/bin/sh -eu /tmp/custom-setup.sh; \
46+
rm -f /tmp/custom-setup.sh; \
47+
fi
48+
3049
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/
3150
COPY --from=builder /usr/lib/libstdc++.so.6* /usr/lib/
3251
COPY --from=builder /srv/target/release/journal-sdk .

0 commit comments

Comments
 (0)