Skip to content

Commit

Permalink
for #291: add arm64 docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Dec 19, 2019
1 parent 4e096ce commit 75847ba
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ linuxarmv6_docker_builder:
docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
docker push $CIRRUS_REPO_FULL_NAME:${TAG}-armv6
linuxarm64_docker_builder:
timeout_in: 120m
env:
DOCKERHUB_USER: ENCRYPTED[ccd1af2835558f6b3e08fa3dd8ad95e7b3eaf3b83220433093d6335a3f4727f4c53c4053587d1594799e72e331d1017d]
DOCKERHUB_PASS: ENCRYPTED[7b81d2ca7878761ea497619cae892e267c0e0fdee71d8ce48dcd4ba11b9351a9d3f2f781dce84a7f8aab92a278007509]
CIRRUS_CLONE_DEPTH: 100
script: |
docker info
export TAG=${CIRRUS_TAG:-latest}
docker build -t $CIRRUS_REPO_FULL_NAME:${TAG}-arm64 . -f Dockerfile.arm64
docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
docker push $CIRRUS_REPO_FULL_NAME:${TAG}-arm64
windows_docker_builder:
only_if: $CIRRUS_TAG == ''
timeout_in: 120m
Expand Down Expand Up @@ -74,6 +87,7 @@ publish_docker_builder:
depends_on:
- linuxarmv6
- linuxarmv7
- linuxarm64
- linux
- windows
- windowstag
Expand All @@ -85,7 +99,7 @@ publish_docker_builder:
docker info
export TAG=${CIRRUS_TAG:-latest}
docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
docker manifest create --amend $CIRRUS_REPO_FULL_NAME:${TAG} $CIRRUS_REPO_FULL_NAME:${TAG}-amd64 $CIRRUS_REPO_FULL_NAME:${TAG}-armv6 $CIRRUS_REPO_FULL_NAME:${TAG}-armv7 $CIRRUS_REPO_FULL_NAME:${TAG}-windows
docker manifest create --amend $CIRRUS_REPO_FULL_NAME:${TAG} $CIRRUS_REPO_FULL_NAME:${TAG}-amd64 $CIRRUS_REPO_FULL_NAME:${TAG}-armv6 $CIRRUS_REPO_FULL_NAME:${TAG}-armv7 $CIRRUS_REPO_FULL_NAME:${TAG}-windows $CIRRUS_REPO_FULL_NAME:${TAG}-arm64
docker manifest annotate $CIRRUS_REPO_FULL_NAME:${TAG} $CIRRUS_REPO_FULL_NAME:${TAG}-armv7 --os linux --arch arm --variant v7
docker manifest annotate $CIRRUS_REPO_FULL_NAME:${TAG} $CIRRUS_REPO_FULL_NAME:${TAG}-armv6 --os linux --arch arm --variant v6
docker manifest push $CIRRUS_REPO_FULL_NAME:${TAG} -p
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ if (NOT EXISTS ${WEBRTCROOT}/src/out/${WEBRTCBUILD}/args.gn)
set (WEBRTCARGS target_cpu="arm"\narm_version=6\narm_float_abi="hard"\nrtc_include_opus=false\n${WEBRTCARGS})
set (WEBRTCARGS use_sysroot=false\n${WEBRTCARGS})
set (WEBRTCARGS is_clang=false\n${WEBRTCARGS})
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv.*")
set (WEBRTCARGS target_cpu="arm"\n${WEBRTCARGS})
set (WEBRTCARGS use_sysroot=true\n${WEBRTCARGS})
set (WEBRTCARGS is_clang=true\n${WEBRTCARGS})
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set (WEBRTCARGS target_cpu="arm64"\n${WEBRTCARGS})
set (WEBRTCARGS use_sysroot=true\n${WEBRTCARGS})
set (WEBRTCARGS is_clang=true\n${WEBRTCARGS})
else()
set (WEBRTCARGS use_sysroot=false\n${WEBRTCARGS})
set (WEBRTCARGS is_clang=true\n${WEBRTCARGS})
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ARG IMAGE=arm64v8/ubuntu

# build
FROM ubuntu:18.04 as builder
LABEL [email protected]

ARG ARCH=arm64

WORKDIR /webrtc-streamer
COPY . /webrtc-streamer

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget git python xz-utils cmake make gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
&& mkdir /webrtc \
&& git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git /webrtc/depot_tools \
&& export PATH=/webrtc/depot_tools:$PATH \
&& cd /webrtc \
&& fetch --no-history --nohooks webrtc \
&& sed -i -e "s|'src/resources'],|'src/resources'],'condition':'rtc_include_tests==true',|" src/DEPS \
&& /webrtc/src/build/linux/sysroot_scripts/install-sysroot.py --arch=arm64 \
&& gclient sync \
&& cd /webrtc-streamer \
&& cmake -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -DWEBRTCDESKTOPCAPTURE=OFF . && make \
&& cpack \
&& mkdir /app && tar xvzf webrtc-streamer*.tar.gz --strip=1 -C /app/ \
&& rm -rf /webrtc && rm -f *.a && rm -f src/*.o \
&& apt-get clean && rm -rf /var/lib/apt/lists/

# run
FROM $IMAGE

WORKDIR /app
COPY --from=builder /app/ /app/

EXPOSE 8000

ENTRYPOINT [ "./webrtc-streamer" ]
CMD [ "-a", "-C", "config.json" ]

0 comments on commit 75847ba

Please sign in to comment.