From 778dae7e1fdb1fe5aee034038131b595af668e0b Mon Sep 17 00:00:00 2001 From: shanurrahman Date: Sun, 19 Nov 2023 20:59:11 +0300 Subject: [PATCH] Adding github ci workflow --- .github/workflows/main.yml | 30 ++++++++++++++++++++++++++++++ Dockerfile | 25 ++++++++++++------------- 2 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b2acbd2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: ci + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3c24f95..e31fa3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,13 @@ -FROM rust:latest - -RUN apt update && apt upgrade -y -RUN apt install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross - -RUN rustup target add aarch64-unknown-linux-gnu -RUN rustup toolchain install stable-aarch64-unknown-linux-gnu - -WORKDIR /app - -ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ - +# Dockerfile +FROM rust:latest + +WORKDIR /app + +# Copy the source code into the container COPY . . -CMD ["cargo", "build", "--target", "aarch64-unknown-linux-gnu"] \ No newline at end of file + +# Build the Rust application +RUN cargo build --release + +# Set the entry point for the application +CMD ["./target/release/scanner"] \ No newline at end of file