diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb5e962..23605db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,24 @@ jobs: - name: Build RPC (Debug) run: cd build && cmake --build . --config Debug - + build-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: docker build + run: docker build -f "Dockerfile" --tag vprodemo.azurecr.io/rpc:${{ github.sha }} --tag vprodemo.azurecr.io/rpc:latest . + - name: Docker Login + uses: docker/login-action@v1.6.0 + with: + registry: vprodemo.azurecr.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + logout: true + - name: Push the Docker image to the registry + run: docker push vprodemo.azurecr.io/rpc:${{ github.sha }} + - name: Push the Docker image to the registry + run: docker push vprodemo.azurecr.io/rpc:latest + build-linux: runs-on: ${{ matrix.os }} strategy: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fbda4d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +#********************************************************************* +# Copyright (c) Intel Corporation 2021 +# SPDX-License-Identifier: Apache-2.0 +#*********************************************************************/ + +FROM ubuntu:20.04 AS rpc-builder + +WORKDIR / +ARG DEBIAN_FRONTEND=noninteractive +RUN \ + apt-get update -y -qq && \ + apt install -y -qq \ + git cmake build-essential libssl-dev zlib1g-dev \ + curl unzip zip pkg-config +RUN git clone https://github.com/open-amt-cloud-toolkit/rpc.git +WORKDIR /rpc +RUN mkdir -p build +RUN git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git +RUN cd vcpkg && ./bootstrap-vcpkg.sh +RUN ./vcpkg/vcpkg install cpprestsdk[websockets] + +WORKDIR /rpc/build +RUN cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake .. +RUN cmake --build . + +FROM ubuntu:20.04 + +LABEL license='SPDX-License-Identifier: Apache-2.0' \ + copyright='Copyright (c) 2021: Intel' + +WORKDIR /root +RUN \ + apt-get update -y -qq && \ + apt install -y -qq \ + libssl-dev +COPY --from=rpc-builder /rpc/build/rpc . +ENTRYPOINT ["/root/rpc"] \ No newline at end of file