Skip to content

Commit

Permalink
modify makefiles and dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: a3hadi <[email protected]>
  • Loading branch information
ayildirim21 committed Apr 23, 2024
1 parent 185dc5b commit 1b380fc
Show file tree
Hide file tree
Showing 70 changed files with 212 additions and 252 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
"pkg/mapper/examples/retry", "pkg/mapper/examples/tickgen", "pkg/mapstreamer/examples/flatmap_stream",
"pkg/reducer/examples/counter", "pkg/reducer/examples/sum", "pkg/reducestreamer/examples/counter",
"pkg/reducestreamer/examples/sum", "pkg/sessionreducer/examples/counter", "pkg/sessionreducer/examples/sum",
"pkg/sideinput/examples/simple-sideinput/udf", "pkg/sideinput/examples/simple-sideinput", "pkg/sinker/examples/log",
"pkg/sideinput/examples/simple_sideinput/udf", "pkg/sideinput/examples/simple_sideinput", "pkg/sinker/examples/log",
"pkg/sourcer/examples/simple_source", "pkg/sourcetransformer/examples/assign_event_time", "pkg/sourcetransformer/examples/event_time_filter",
"pkg/sinker/examples/fallback", "pkg/sideinput/examples/map-side-input", "pkg/sideinput/examples/reduce-side-input",
"pkg/sideinput/examples/sideInput-function", "pkg/sideinput/examples/simple-source-with-sideinput",
"pkg/sideinput/examples/sink-side-input", "pkg/sinker/examples/redis-e2e-test-sink"
"pkg/sinker/examples/fallback", "pkg/sideinput/examples/map_sideinput", "pkg/sideinput/examples/reduce_sideinput",
"pkg/sideinput/examples/sideinput_function", "pkg/sideinput/examples/simple_source_with_sideinput",
"pkg/sideinput/examples/sink_sideinput", "pkg/sinker/examples/redis-sink"
]

steps:
Expand Down
25 changes: 0 additions & 25 deletions pkg/sideinput/examples/map-side-input/Makefile

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/sideinput/examples/map-side-input/udf/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions pkg/sideinput/examples/map_sideinput/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
####################################################################################################
# base
####################################################################################################
FROM alpine:3.12.3 as base
RUN apk update && apk upgrade && \
apk add ca-certificates && \
apk --no-cache add tzdata

COPY dist/map-sideinput-example /bin/map-sideinput-example
RUN chmod +x /bin/map-sideinput-example

####################################################################################################
# sideinput
####################################################################################################
FROM scratch as sideinput
ARG ARCH
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=base /bin/map-sideinput-example /bin/map-sideinput-example
ENTRYPOINT [ "/bin/map-sideinput-example" ]
18 changes: 18 additions & 0 deletions pkg/sideinput/examples/map_sideinput/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TAG ?= stable
PUSH ?= false

.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/map-sideinput-example main.go

.PHONY: image-push
image-push: build
docker buildx build -t "quay.io/numaio/numaflow-go/map-sideinput:${TAG}" --platform linux/amd64,linux/arm64 --target sideinput . --push

.PHONY: image
image: build
docker build -t "quay.io/numaio/numaflow-go/map-sideinput:${TAG}" --target sideinput .
@if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-sideinput:${TAG}"; fi

clean:
-rm -rf ./dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ spec:
sideInputs:
- name: myticker
container:
# A map side input example , see https://github.com/numaproj-contrib/e2e-tests-go/tree/main/map-side-input
image: "quay.io/numaio/numaproj-contrib/e2e-map-sideinput-example:v0.0.2"
image: "quay.io/numaio/numaflow-go/map-sideinput:stable"
imagePullPolicy: Always
trigger:
schedule: "@every 5s"
Expand All @@ -40,8 +39,7 @@ Vertex spec for the UDF vertex:
- name: si-e2e
udf:
container:
# A map side input udf , see https://github.com/numaproj-contrib/e2e-tests-go/tree/main/map-side-input/udf
image: "quay.io/numaio/numaproj-contrib/e2e-map-sideinput-udf:v0.0.2"
image: "quay.io/numaio/numaflow-go/map-sideinput-udf:stable"
imagePullPolicy: Always
sideInputs:
- myticker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module map-side-input
module map_sideinput

go 1.21.2

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN chmod +x /bin/map-sideinput-udf
####################################################################################################
# udf-sideinput
####################################################################################################
FROM scratch as map-sideinput-udf
FROM scratch as sideinput-udf
ARG ARCH
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
Expand Down
18 changes: 18 additions & 0 deletions pkg/sideinput/examples/map_sideinput/udf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TAG ?= stable
PUSH ?= false

.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/map-sideinput-udf main.go

.PHONY: image-push
image-push: build
docker buildx build -t "quay.io/numaio/numaflow-go/map-sideinput-udf:${TAG}" --platform linux/amd64,linux/arm64 --target sideinput-udf . --push

.PHONY: image
image: build
docker build -t "quay.io/numaio/numaflow-go/map-sideinput-udf:${TAG}" --target sideinput-udf .
@if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-sideinput-udf:${TAG}"; fi

clean:
-rm -rf ./dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module udf

go 1.21.2

replace github.com/numaproj/numaflow-go => ../../../../..

require (
github.com/fsnotify/fsnotify v1.6.0
github.com/numaproj/numaflow-go v0.7.0-rc2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/numaproj/numaflow-go v0.7.0-rc2 h1:oLP0uM9ToFEtiSyzX46cFOlr7ctgcH02cY/XFA1qF8E=
github.com/numaproj/numaflow-go v0.7.0-rc2/go.mod h1:WoMt31+h3up202zTRI8c/qe42B8UbvwLe2mJH0MAlhI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
Expand Down
20 changes: 0 additions & 20 deletions pkg/sideinput/examples/reduce-side-input/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/sideinput/examples/reduce-side-input/Makefile

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/sideinput/examples/reduce-side-input/udf/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ RUN apk update && apk upgrade && \
apk add ca-certificates && \
apk --no-cache add tzdata

COPY dist/e2e-map-sideinput-example /bin/e2e-map-sideinput-example
RUN chmod +x /bin/e2e-map-sideinput-example
COPY dist/reduce-sideinput-example /bin/reduce-sideinput-example
RUN chmod +x /bin/reduce-sideinput-example

####################################################################################################
# sideinput
####################################################################################################
FROM scratch as sideinput-example
FROM scratch as sideinput
ARG ARCH
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=base /bin/e2e-map-sideinput-example /bin/e2e-map-sideinput-example
ENTRYPOINT [ "/bin/e2e-map-sideinput-example" ]
COPY --from=base /bin/reduce-sideinput-example /bin/reduce-sideinput-example
ENTRYPOINT [ "/bin/reduce-sideinput-example" ]
18 changes: 18 additions & 0 deletions pkg/sideinput/examples/reduce_sideinput/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TAG ?= stable
PUSH ?= false

.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/reduce-sideinput-example main.go

.PHONY: image-push
image-push: build
docker buildx build -t "quay.io/numaio/numaflow-go/reduce-sideinput:${TAG}" --platform linux/amd64,linux/arm64 --target sideinput . --push

.PHONY: image
image: build
docker build -t "quay.io/numaio/numaflow-go/reduce-sideinput:${TAG}" --target sideinput .
@if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-sideinput:${TAG}"; fi

clean:
-rm -rf ./dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ spec:
sideInputs:
- name: myticker
container:
# A reduce side input, see https://github.com/numaproj-contrib/e2e-tests-go/tree/main/reduce-side-input
image: "quay.io/numaio/numaproj-contrib/e2e-reduce-sideinput-example:v0.0.2"
image: "quay.io/numaio/numaflow-go/reduce-sideinput:stable"
imagePullPolicy: Always
trigger:
schedule: "@every 5s"
Expand All @@ -36,8 +35,7 @@ Vertex spec for the UDF vertex:
- name: si-e2e
udf:
container:
# A reduce side input udf, see https://github.com/numaproj-contrib/e2e-tests-go/tree/main/reduce-side-input/udf
image: "quay.io/numaio/numaproj-contrib/e2e-reduce-sideinput-udf:v0.0.2"
image: "quay.io/numaio/numaproj-contrib/reduce-sideinput-udf:stable"
imagePullPolicy: Always
groupBy:
window:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module reduce-side-input
module reduce_sideinput

go 1.21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ RUN apk update && apk upgrade && \
apk --no-cache add tzdata

COPY dist/reduce-sideinput-udf /bin/reduce-sideinput-udf
RUN chmod +x /bin/reduce-sideinput-udf
RUN chmod +x /bin/reduce_sideinput-udf

####################################################################################################
# udf-sideinput
####################################################################################################
FROM scratch as reduce-sideinput-udf
FROM scratch as sideinput-udf
ARG ARCH
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
Expand Down
18 changes: 18 additions & 0 deletions pkg/sideinput/examples/reduce_sideinput/udf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TAG ?= stable
PUSH ?= false

.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/reduce-sideinput-udf main.go

.PHONY: image-push
image-push: build
docker buildx build -t "quay.io/numaio/numaflow-go/reduce-sideinput-udf:${TAG}" --platform linux/amd64,linux/arm64 --target sideinput-udf . --push

.PHONY: image
image: build
docker build -t "quay.io/numaio/numaflow-go/reduce-sideinput-udf:${TAG}" --target sideinput-udf .
@if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-sideinput-udf:${TAG}"; fi

clean:
-rm -rf ./dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module udf

go 1.21.2

replace github.com/numaproj/numaflow-go => ../../../../..

require (
github.com/fsnotify/fsnotify v1.7.0
github.com/numaproj/numaflow-go v0.7.0-rc2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/numaproj/numaflow-go v0.7.0-rc2 h1:oLP0uM9ToFEtiSyzX46cFOlr7ctgcH02cY/XFA1qF8E=
github.com/numaproj/numaflow-go v0.7.0-rc2/go.mod h1:WoMt31+h3up202zTRI8c/qe42B8UbvwLe2mJH0MAlhI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *Sum) Reduce(ctx context.Context, keys []string, reduceCh <-chan reducer
}

if s.sum > 0 && len(siData) > 0 {
msg := []byte("reduce-side-input")
msg := []byte("reduce_sideinput")
return reducer.MessagesBuilder().Append(reducer.NewMessage(msg))
} else {
return reducer.MessagesBuilder().Append(reducer.MessageToDrop())
Expand Down
Loading

0 comments on commit 1b380fc

Please sign in to comment.