Skip to content

Commit

Permalink
connector: provide sample Dockerfile (#4330)
Browse files Browse the repository at this point in the history
* update

* add README
  • Loading branch information
sehz authored Jan 15, 2025
1 parent 2394873 commit f85b75b
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions connector/docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fluvio_profile.*
43 changes: 43 additions & 0 deletions connector/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM debian:stable-slim

RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y tini
RUN apt-get install -y curl

# setup fluvio as non user
ENV USER=fluvio
RUN adduser \
--disabled-password \
--home "/home/$USER" \
"$USER"
USER $USER
WORKDIR /home/fluvio


# install fluvio
RUN curl -fsS https://hub.infinyon.cloud/install/install.sh | bash
RUN ls -la /home/fluvio/.fluvio/bin
ENV PATH="/home/fluvio/.fluvio/bin:$PATH"
RUN export PATH
RUN fluvio version

# copy fluvio profile and test
COPY ./fluvio_profile.toml /home/fluvio/.fluvio/config
# RUN fluvio topic list

WORKDIR /home/fluvio/connector


# Download specific connector, you can configure this to download the connector you need
RUN cdk hub download infinyon/[email protected]
RUN tar xf infinyon-http-source-0.3.8.ipkg
RUN tar -xzf manifest.tar.gz
RUN ls -la


# Copy connector configuration
COPY ./connector.yaml /home/fluvio/connector
RUN ls -la /home/fluvio/connector

# run http-source, this will be different for each connector
ENTRYPOINT ["/home/fluvio/connector/http-source", "--config", "/home/fluvio/connector/connector.yaml"]
12 changes: 12 additions & 0 deletions connector/docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ORG=myorg
IMAGE=http-source
VERSION=0.3.8

copy-profile:
fluvio profile export > fluvio_profile.toml

build: copy-profile
docker build --progress=plain -t $(ORG)/$(IMAGE):$(VERSION) .

run: build
docker run --network host --rm $(ORG)/$(IMAGE):$(VERSION)
27 changes: 27 additions & 0 deletions connector/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Introduction

This is sample project to demonstrate how to use the docker to run the connector.
This examples is for http connector but can be used for any connector.

# To build image

To build docker image run:
```
make build
```

This will copy following files from your local file system:
- your current fluvio profile
- connector.yaml

The connector.yaml is connector config for http source


# To run image

To run image, run:
```
make run
```

This setup will run `host` network mode. This means that connector will be able to access the local network. If you want to run in different network mode, you can modify the `Makefile` to change the network mode.
9 changes: 9 additions & 0 deletions connector/docker/connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 0.1.0
meta:
version: 0.3.8
name: http-quotes
type: http-source
topic: quotes
http:
endpoint: https://demo-data.infinyon.com/api/quote
interval: 2s

0 comments on commit f85b75b

Please sign in to comment.