diff --git a/.dockerignore b/.dockerignore index a8e0218..1336220 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,6 @@ test_* tmp/ .vscode/ -.git/ CMakeFiles/ examples/ +Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..2b2fb6b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,26 @@ +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + debian_version: [buster, bullseye] + docker_arch: [amd64, arm32v7, arm64v8] + build_type: ["non-rpi", "rpi"] + exclude: + - docker_arch: amd64 + build_type: rpi + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Build Dockerfile + run: docker build --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE . + env: + DEBIAN_VERSION: ${{ matrix.debian_version }} + DOCKER_ARCH: ${{ matrix.docker_arch }}/ + BUILD_TYPE: ${{ matrix.build_type }} diff --git a/Dockerfile b/Dockerfile index c9ab035..5fa8d2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,26 @@ ARG DEBIAN_VERSION FROM ${DOCKER_ARCH}debian:${DEBIAN_VERSION} as build_env # Default packages -RUN apt-get -y update && apt-get -y install gnupg2 libavformat-dev libavutil-dev libavcodec-dev v4l-utils pkg-config xxd build-essential ccache +RUN apt-get -y update && apt-get -y install gnupg2 build-essential xxd cmake ccache git-core pkg-config \ + libavformat-dev libavutil-dev libavcodec-dev libssl-dev v4l-utils # Add RPI packages ARG DEBIAN_VERSION -RUN echo "deb http://archive.raspberrypi.org/debian/ $DEBIAN_VERSION main" > /etc/apt/sources.list.d/raspi.list -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E -RUN apt-get -y update && apt-get -y install libcamera-dev liblivemedia-dev +ARG BUILD_TYPE="non-rpi" +RUN [ "$BUILD_TYPE" != "rpi" ] || \ + ( \ + echo "deb http://archive.raspberrypi.org/debian/ $DEBIAN_VERSION main" > /etc/apt/sources.list.d/raspi.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E && \ + apt-get -y update && \ + apt-get -y install libcamera-dev liblivemedia-dev \ + ) + +FROM scratch as build +COPY --from=build_env / . + +ADD / /src +WORKDIR /src +RUN git clean -ffdx +RUN git submodule update --init --recursive --recommend-shallow +RUN git submodule foreach git clean -ffdx +RUN make -j$(nproc) diff --git a/output/rtsp/rtsp.cc b/output/rtsp/rtsp.cc index a9d4ea0..cd06a72 100644 --- a/output/rtsp/rtsp.cc +++ b/output/rtsp/rtsp.cc @@ -276,7 +276,7 @@ error: #else // USE_RTSP -extern "C" int rtsp_server() +extern "C" int rtsp_server(rtsp_options_t *options) { return 0; }