From 7ab8fad636ccee21c4bb7757654a1eb9aa04b673 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Fri, 31 May 2024 15:11:30 -0400 Subject: [PATCH 1/3] added docker files --- .github/workflows/tests.yml | 30 ++++++++++++++++++++++++++++++ Dockerfile | 25 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 Dockerfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..96f08b4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: Code Quality + +on: push + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + run: | + rustup update --no-self-update stable + rustup component add --toolchain stable rustfmt rust-src + rustup default stable + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose + + - name: Run clippy + run: cargo clippy -- -D warnings + + - name: Run fmt check + run: cargo fmt -- --check + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..df97b56 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM rust:slim-bookworm as build +ARG TAGOIO_SOURCE_FOLDER="/tago-io" + +RUN apt update +RUN apt install -y protobuf-compiler libssl-dev gcc pkg-config build-essential + +RUN mkdir -p ${TAGOIO_SOURCE_FOLDER} +WORKDIR ${TAGOIO_SOURCE_FOLDER} +ADD . ${TAGOIO_SOURCE_FOLDER} + +RUN cargo build --release + +FROM debian:bookworm-slim +ARG TAGOIO_SOURCE_FOLDER="/tago-io" + +RUN apt update +RUN apt install -y build-essential netcat-traditional ca-certificates +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p ${TAGOIO_SOURCE_FOLDER} +WORKDIR ${TAGOIO_SOURCE_FOLDER} +COPY --from=build ${TAGOIO_SOURCE_FOLDER}/target/release/tagoio-mqtt-relay . +COPY --from=build ${TAGOIO_SOURCE_FOLDER}/config.toml config.toml + +ENTRYPOINT ["/tago-io/tagoio-mqtt-relay"] From 56fb1475e76208c3cddfbcdffc7816bda0bed67d Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Fri, 31 May 2024 15:13:38 -0400 Subject: [PATCH 2/3] removed rust-src --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96f08b4..09202e9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: - name: Install Rust toolchain run: | rustup update --no-self-update stable - rustup component add --toolchain stable rustfmt rust-src + rustup component add --toolchain stable rustfmt rustup default stable - name: Build From 9a1392941fc1b1e887e394c32c938ddd23e42c5a Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Fri, 31 May 2024 22:22:41 -0400 Subject: [PATCH 3/3] Update tests.yml --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 09202e9..66e321d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,6 +2,9 @@ name: Code Quality on: push +env: + CARGO_TERM_COLOR: always + jobs: build: runs-on: ubuntu-latest