diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 00000000..af163826 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,51 @@ +name: Build + +on: + push: + branches: + - main + +jobs: + build-and-push-image: + strategy: + matrix: + feature: + - goesproc + - goesrecv + platform: + - linux/arm64 + - linux/amd64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Log into registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + build-args: + version=latest + context: . + target: ${{ matrix.feature }} + platforms: ${{ matrix.platform }} + push: true + tags: ghcr.io/${{ github.repository }}/${{ matrix.feature }}:latest + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 7939c016..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - "Ubuntu": - strategy: - fail-fast: false - matrix: - version: - - "16.04" - - "18.04" - - "20.04" - - "22.04" - - "24.04" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: docker build --tag build:ubuntu-${{ matrix.version }} --build-arg version=${{ matrix.version }} docker/ubuntu - name: "docker build" - - run: docker run --detach --interactive --name build --volume $PWD:/goestools build:ubuntu-${{ matrix.version }} - name: "docker run" - - run: docker exec -t build /run_cmake.sh - name: "cmake" - - run: docker exec -t build /run_compile.sh - name: "make" diff --git a/CMakeLists.txt b/CMakeLists.txt index 81bc4cb8..dc79560f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,14 +22,14 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") # Assume Raspbian if we're cross compiling for ARM - if(CMAKE_CROSSCOMPILING) - # Raspbian supports multiarch and as such places libraries in - # directories named after their architecture identifier. - shift_link_directories(${RASPBERRYPI_SYSROOT}/lib/arm-linux-gnueabihf) - shift_link_directories(${RASPBERRYPI_SYSROOT}/usr/lib/arm-linux-gnueabihf) - set(ENV{PKG_CONFIG_PATH} "${RASPBERRYPI_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig") - set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RASPBERRYPI_SYSROOT}") - endif() + #if(CMAKE_CROSSCOMPILING) + # # Raspbian supports multiarch and as such places libraries in + # # directories named after their architecture identifier. + # shift_link_directories(${RASPBERRYPI_SYSROOT}/lib/arm-linux-gnueabihf) + # shift_link_directories(${RASPBERRYPI_SYSROOT}/usr/lib/arm-linux-gnueabihf) + # set(ENV{PKG_CONFIG_PATH} "${RASPBERRYPI_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig") + # set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RASPBERRYPI_SYSROOT}") + #endif() endif() if(SANITIZE_ADDRESS OR SANITIZE_MEMORY OR diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3a1e9f94 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +ARG version +FROM debian:${version} AS build-env + +ENV TZ="Etc/UTC" +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential cmake git-core libairspy-dev libopencv-dev libproj-dev librtlsdr-dev zlib1g-dev pkgconf +WORKDIR /build +COPY . /goestools +RUN cmake /goestools +RUN make +RUN ls -al /build + +FROM debian:${version} AS goesrecv +ENV TZ="Etc/UTC" +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get upgrade -y && apt-get install -y \ + librtlsdr0 \ + libairspy0 \ + && rm -rf /var/lib/apt/lists/* +WORKDIR /goesrecv +COPY --from=build-env /build/src/goesrecv/goesrecv . +CMD ["./goesrecv","-c","/config/goesrecv.conf"] + +FROM debian:${version} AS goesproc +ENV TZ="Etc/UTC" +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get upgrade -y && apt-get install -y \ + libopencv-dev \ + && rm -rf /var/lib/apt/lists/* +WORKDIR /goesproc +COPY --from=build-env /build/src/goesproc/goesproc . +COPY --from=build-env /build/share/goesproc-goesr.conf ./config/goesproc.conf +CMD ["./goesproc","-c","/config/goesproc.conf","--out","/media/","-m","packet","--subscribe","tcp://127.0.0.1:5004"] diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile deleted file mode 100644 index c959001c..00000000 --- a/docker/ubuntu/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -ARG version -FROM ubuntu:${version} - -ARG DEBIAN_FRONTEND=noninteractive -ENV TZ=UTC - -RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ - git-core \ - libairspy-dev \ - libopencv-dev \ - libproj-dev \ - librtlsdr-dev \ - zlib1g-dev \ - && rm -rf /var/lib/apt/lists/* - -COPY ./run_cmake.sh / -COPY ./run_compile.sh / diff --git a/docker/ubuntu/run_cmake.sh b/docker/ubuntu/run_cmake.sh deleted file mode 100755 index 39fc63d1..00000000 --- a/docker/ubuntu/run_cmake.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e - -mkdir -p /tmp/goestools -cd /tmp/goestools -cmake /goestools diff --git a/docker/ubuntu/run_compile.sh b/docker/ubuntu/run_compile.sh deleted file mode 100755 index 51de9763..00000000 --- a/docker/ubuntu/run_compile.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e - -cd /tmp/goestools -make -j $(nproc) diff --git a/vendor/libaec b/vendor/libaec index d808db1e..be7cc28b 160000 --- a/vendor/libaec +++ b/vendor/libaec @@ -1 +1 @@ -Subproject commit d808db1e1276f6c23feccdcefd56f7e38e2d7c9e +Subproject commit be7cc28bddc570209a0de4b7338ea2de16c7c007 diff --git a/vendor/libcorrect b/vendor/libcorrect index a3c8890b..ce6c17f1 160000 --- a/vendor/libcorrect +++ b/vendor/libcorrect @@ -1 +1 @@ -Subproject commit a3c8890b43486822900a2c65a33701fe35bdc0e2 +Subproject commit ce6c17f1f988765ae3695315d7cce1f2a2e6cf0d diff --git a/vendor/nanomsg b/vendor/nanomsg index 0c1aa2b2..fc3f684a 160000 --- a/vendor/nanomsg +++ b/vendor/nanomsg @@ -1 +1 @@ -Subproject commit 0c1aa2b288f6b167dbafe7e29c20e6fc7e71c000 +Subproject commit fc3f684a80151a3319446fc96083a9ff384ee4fe diff --git a/vendor/sanitizers-cmake b/vendor/sanitizers-cmake index f09151bc..3f0542e4 160000 --- a/vendor/sanitizers-cmake +++ b/vendor/sanitizers-cmake @@ -1 +1 @@ -Subproject commit f09151bc87ba210f955d58dffc07b0ee1e755234 +Subproject commit 3f0542e4e034aab417c51b2b22c94f83355dee15 diff --git a/vendor/tinytoml b/vendor/tinytoml index 8fe89097..f5a2013e 160000 --- a/vendor/tinytoml +++ b/vendor/tinytoml @@ -1 +1 @@ -Subproject commit 8fe890978b3390de1fc1f26c2d6bf1711c700c5a +Subproject commit f5a2013ec8c82744fd3f6556dd128a83e8fb5184