Skip to content

Commit 4c36ecd

Browse files
committed
perf: optimize Docker build using pre-built binaries
- Remove Rust compilation from Dockerfile (no builder stage) - Use pre-built binaries from build-binaries job artifacts - Download and extract Linux binaries for amd64/arm64 - Reduce Docker build time from 30+ min to ~2-3 min - Reduce timeout from 30 to 15 minutes Docker build now simply copies files instead of compiling Rust workspace.
1 parent 19ba66e commit 4c36ecd

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,23 @@ jobs:
105105
name: Publish Docker Image
106106
needs: [build-binaries]
107107
runs-on: ubuntu-latest
108-
timeout-minutes: 30
108+
timeout-minutes: 15
109109
steps:
110110
- uses: actions/checkout@v6
111+
- name: Download Linux binaries
112+
uses: actions/download-artifact@v7
113+
with:
114+
pattern: binary-*-unknown-linux-gnu
115+
path: artifacts
116+
- name: Extract and prepare binaries
117+
run: |
118+
mkdir -p binaries
119+
tar -xzf artifacts/binary-x86_64-unknown-linux-gnu/zeph-x86_64-unknown-linux-gnu.tar.gz -C binaries
120+
mv binaries/zeph binaries/zeph-amd64
121+
tar -xzf artifacts/binary-aarch64-unknown-linux-gnu/zeph-aarch64-unknown-linux-gnu.tar.gz -C binaries
122+
mv binaries/zeph binaries/zeph-arm64
123+
chmod +x binaries/zeph-*
124+
ls -lh binaries/
111125
- uses: docker/setup-qemu-action@v3
112126
- uses: docker/setup-buildx-action@v3
113127
- uses: docker/login-action@v3

Dockerfile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
FROM rust:1.88-slim-bookworm AS builder
2-
3-
WORKDIR /build
4-
5-
COPY Cargo.toml Cargo.lock ./
6-
COPY src/ src/
7-
COPY crates/ crates/
8-
9-
RUN cargo build --release && strip target/release/zeph
10-
111
FROM container-registry.oracle.com/os/oraclelinux:9-slim
122

3+
ARG TARGETARCH
4+
135
RUN microdnf install -y shadow-utils ca-certificates && \
146
microdnf clean all && \
157
useradd --system --no-create-home --shell /sbin/nologin zeph
168

179
WORKDIR /app
1810

19-
COPY --from=builder /build/target/release/zeph /app/zeph
11+
COPY binaries/zeph-${TARGETARCH} /app/zeph
2012
COPY config/ /app/config/
2113
COPY skills/ /app/skills/
2214

23-
RUN chown -R zeph:zeph /app
15+
RUN chown -R zeph:zeph /app && \
16+
chmod +x /app/zeph
2417

2518
USER zeph
2619

0 commit comments

Comments
 (0)