Skip to content

Commit

Permalink
dekaf: Update to build in GH actions environment directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jshearer committed Sep 16, 2024
1 parent 275cea0 commit b706985
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/dekaf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,41 @@ on:

jobs:
build-and-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl

- run: sudo apt install -y musl-tools

- name: Login to GitHub container registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login --username ${{ github.actor }} --password-stdin ghcr.io
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
crates/dekaf
- name: build `dekaf`
run: cargo build --target x86_64-unknown-linux-musl --release -p dekaf

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run git describe
id: git_describe
run: echo "describe_output=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image.
# The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@a64d0487d7069df33b279515d35d60fa80e2ea62
uses: docker/metadata-action@v5
with:
images: ghcr.io/estuary/dekaf
tags: |
Expand Down
19 changes: 1 addition & 18 deletions crates/dekaf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
RUN apt-get update && apt-get install -y clang

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --bin dekaf

# We do not need the Rust toolchain to run the binary!
FROM debian:bookworm-slim AS runtime
WORKDIR /app
COPY --from=builder /app/target/release/dekaf /
COPY target/x86_64-unknown-linux-musl/release/dekaf /
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -y libssl3 ca-certificates
Expand Down

0 comments on commit b706985

Please sign in to comment.