-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: automate docker build and push + fix broken examples #62
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
356104e
feat: automate docker build and push
ayildirim21 0391e98
Merge branch 'main' into build-push
ayildirim21 ab086d4
add local references to a couple examples
ayildirim21 8f87a6f
add local references to a couple examples
ayildirim21 7f9bad5
fix merge conflict
ayildirim21 e5a23dd
Merge branch 'build-push' of github.com:ayildirim21/numaflow-rs into …
ayildirim21 9af7e22
use local references for all examples + fix broken examples
ayildirim21 dc271ad
cleanup
ayildirim21 4a41c3e
rename
ayildirim21 bc5fcd9
test github actions workflow
ayildirim21 4df4b6c
test
ayildirim21 871c162
test
ayildirim21 8feea5c
modify workflow
ayildirim21 a6cf278
replace repo with image_registry
ayildirim21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Docker Publish | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
docker_publish: | ||
# run workflow only on numaproj/numaflow-rs repository | ||
if: ${{ github.repository }} == "numaproj/numaflow-rs" | ||
name: Build, Tag, and Push Image | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
dockerfile_paths: [ | ||
"examples/map-cat", "examples/map-tickgen-serde", "examples/mapt-event-time-filter", | ||
"examples/reduce-counter", "examples/sideinput", "examples/sideinput/udf", | ||
"examples/simple-source", "examples/sink-log", "examples/source-transformer-now" | ||
] | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Install protobuf compiler | ||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Quay.io registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.NUMAIO_USERNAME }} | ||
password: ${{ secrets.NUMAIO_PASSWORD }} | ||
- name: Build, tag, and push images | ||
run: ./hack/update_examples.sh --build-push-example ${{ matrix.dockerfile_paths }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
FROM rust:1.75-bookworm as build | ||
FROM rust:1.75-bookworm AS build | ||
|
||
RUN apt-get update | ||
RUN apt-get install protobuf-compiler -y | ||
|
||
# create a new empty shell project | ||
WORKDIR /examples | ||
|
||
# copy your source tree | ||
COPY src ./src | ||
|
||
COPY ./Cargo.toml ./Cargo.toml | ||
COPY ./Cargo.lock ./Cargo.lock | ||
WORKDIR /numaflow-rs | ||
COPY ./ ./ | ||
WORKDIR /numaflow-rs/examples/map-cat | ||
|
||
# build for release | ||
RUN cargo build --release | ||
|
||
# our final base | ||
FROM debian:bookworm | ||
FROM debian:bookworm AS map-cat | ||
|
||
# copy the build artifact from the build stage | ||
COPY --from=build /examples/target/release/server . | ||
COPY --from=build /numaflow-rs/examples/map-cat/target/release/server . | ||
|
||
# set the startup command to run your binary | ||
CMD ["./server"] | ||
CMD ["./server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TAG ?= stable | ||
PUSH ?= false | ||
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/map-cat:${TAG} | ||
DOCKER_FILE_PATH = examples/map-cat/Dockerfile | ||
|
||
.PHONY: update | ||
update: | ||
cargo check | ||
cargo update | ||
|
||
.PHONY: image | ||
image: update | ||
cd ../../ && docker build \ | ||
-f ${DOCKER_FILE_PATH} \ | ||
-t ${IMAGE_REGISTRY} . | ||
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
FROM rust:1.75-bookworm as build | ||
FROM rust:1.75-bookworm AS build | ||
|
||
RUN apt-get update | ||
RUN apt-get install protobuf-compiler -y | ||
|
||
# create a new empty shell project | ||
WORKDIR /examples | ||
|
||
# copy your source tree | ||
COPY src ./src | ||
|
||
COPY ./Cargo.toml ./Cargo.toml | ||
COPY ./Cargo.lock ./Cargo.lock | ||
WORKDIR /numaflow-rs | ||
COPY ./ ./ | ||
WORKDIR /numaflow-rs/examples/map-tickgen-serde | ||
|
||
# build for release | ||
RUN cargo build --release | ||
|
||
# our final base | ||
FROM debian:bookworm | ||
FROM debian:bookworm AS map-tickgen-serde | ||
|
||
# copy the build artifact from the build stage | ||
COPY --from=build /examples/target/release/server . | ||
COPY --from=build /numaflow-rs/examples/map-tickgen-serde/target/release/server . | ||
|
||
# set the startup command to run your binary | ||
CMD ["./server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TAG ?= stable | ||
PUSH ?= false | ||
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/map-tickgen-serde:${TAG} | ||
DOCKER_FILE_PATH = examples/map-tickgen-serde/Dockerfile | ||
|
||
.PHONY: update | ||
update: | ||
cargo check | ||
cargo update | ||
|
||
.PHONY: image | ||
image: update | ||
cd ../../ && docker build \ | ||
-f ${DOCKER_FILE_PATH} \ | ||
-t ${IMAGE_REGISTRY} . | ||
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM rust:1.75-bookworm AS build | ||
|
||
RUN apt-get update | ||
RUN apt-get install protobuf-compiler -y | ||
|
||
WORKDIR /numaflow-rs | ||
COPY ./ ./ | ||
WORKDIR /numaflow-rs/examples/mapt-event-time-filter | ||
|
||
# build for release | ||
RUN cargo build --release | ||
|
||
# our final base | ||
FROM debian:bookworm AS mapt-event-time-filter | ||
|
||
# copy the build artifact from the build stage | ||
COPY --from=build /numaflow-rs/examples/mapt-event-time-filter/target/release/server . | ||
|
||
# set the startup command to run your binary | ||
CMD ["./server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TAG ?= stable | ||
PUSH ?= false | ||
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/mapt-event-time-filter:${TAG} | ||
DOCKER_FILE_PATH = examples/mapt-event-time-filter/Dockerfile | ||
|
||
.PHONY: update | ||
update: | ||
cargo check | ||
cargo update | ||
|
||
.PHONY: image | ||
image: update | ||
cd ../../ && docker build \ | ||
-f ${DOCKER_FILE_PATH} \ | ||
-t ${IMAGE_REGISTRY} . | ||
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
FROM rust:1.70 as build | ||
FROM rust:1.70 AS build | ||
|
||
RUN apt-get update | ||
RUN apt-get install protobuf-compiler -y | ||
|
||
# create a new empty shell project | ||
WORKDIR /examples | ||
|
||
# copy your source tree | ||
COPY src ./src | ||
|
||
COPY ./Cargo.toml ./Cargo.toml | ||
COPY ./Cargo.lock ./Cargo.lock | ||
WORKDIR /numaflow-rs | ||
COPY ./ ./ | ||
WORKDIR /numaflow-rs/examples/reduce-counter | ||
|
||
# build for release | ||
RUN cargo build --release | ||
|
||
# our final base | ||
FROM rust | ||
FROM rust AS reduce-counter | ||
|
||
# copy the build artifact from the build stage | ||
COPY --from=build /examples/target/release/server . | ||
COPY --from=build /numaflow-rs/examples/reduce-counter/target/release/server . | ||
|
||
# set the startup command to run your binary | ||
CMD ["./server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TAG ?= stable | ||
PUSH ?= false | ||
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/reduce-counter:${TAG} | ||
DOCKER_FILE_PATH = examples/reduce-counter/Dockerfile | ||
|
||
.PHONY: update | ||
update: | ||
cargo check | ||
cargo update | ||
|
||
.PHONY: image | ||
image: update | ||
cd ../../ && docker build \ | ||
-f ${DOCKER_FILE_PATH} \ | ||
-t ${IMAGE_REGISTRY} . | ||
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might copy unwanted files, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I guess rather than copy the entire root directory with
COPY ./ ./,
the only necessary things necessary to copy over would be src/, proto/, Cargo.toml, and build.rs? Is there anything else?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for examples, we do not require proto, build.rs, etc., right?