Skip to content

Commit

Permalink
make number of build cpus configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Apr 4, 2024
1 parent 63845b6 commit b8e1c92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
with:
context: .
tags: ${{ steps.prepare_tag.outputs.image_id }}:${{ steps.prepare_tag.outputs.version }}
build-args: BUILD_CPUS=16
# For pull requests, export results to the build cache.
# Otherwise, push to a registry.
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry,push=true' }}
28 changes: 15 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SHELL ["/bin/bash", "-c"]

ENV PATH="/usr/local/bin:${PATH}"

ARG BUILD_CPUS=1

COPY ./files/* /tmp/

RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done \
Expand Down Expand Up @@ -98,47 +100,47 @@ RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done \
&& cd /usr/local/src/freeswitch/src \
&& cp /tmp/switch_event.c . \
&& cd /usr/local/src/libwebsockets \
&& mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j 16 && make install \
&& mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j${BUILD_CPUS} && make install \
&& cd /usr/local/src/freeswitch/libs/libfvad && cp /tmp/configure.ac.libfvad configure.ac \
&& autoreconf -i && ./configure && make -j 16 && make install \
&& autoreconf -i && ./configure && make -j${BUILD_CPUS} && make install \
&& cd /usr/local/src/freeswitch/libs/spandsp \
&& ./bootstrap.sh && ./configure && make -j 16 && make install \
&& ./bootstrap.sh && ./configure && make -j${BUILD_CPUS} && make install \
&& cd /usr/local/src/freeswitch/libs/sofia-sip \
&& ./bootstrap.sh && ./configure && make -j 16 && make install \
&& ./bootstrap.sh && ./configure && make -j${BUILD_CPUS} && make install \
&& cd /usr/local/src/freeswitch/libs/aws-c-common \
&& mkdir -p build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS="-Wno-unused-parameter" \
&& make -j 16 && make install \
&& make -j${BUILD_CPUS} && make install \
&& cd /usr/local/src/freeswitch/libs/aws-sdk-cpp \
&& git submodule update --init --recursive \
&& mkdir -p build && cd build \
&& cmake .. -DBUILD_ONLY="lexv2-runtime;transcribestreaming" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="-Wno-unused-parameter -Wno-error=nonnull -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=maybe-uninitialized" \
&& make -j 16 && make install \
&& make -j${BUILD_CPUS} && make -j${BUILD_CPUS} install \
&& find /usr/local/src/freeswitch/libs/aws-sdk-cpp/ -type f -name "*.pc" | xargs cp -t /usr/local/lib/pkgconfig/ \
&& echo building grpc \
&& cd /usr/local/src/grpc \
&& git submodule update --init --recursive \
&& mkdir -p cmake/build \
&& cd cmake/build \
&& cmake -DBUILD_SHARED_LIBS=ON -DgRPC_SSL_PROVIDER=package -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. \
&& make -j 16 \
&& make -j${BUILD_CPUS} \
&& make install \
&& cd /usr/local/src/freeswitch/libs/googleapis \
&& LANGUAGE=cpp FLAGS+='--experimental_allow_proto3_optional' make -j 16 \
&& LANGUAGE=cpp FLAGS+='--experimental_allow_proto3_optional' make -j${BUILD_CPUS} \
&& cd /usr/local/src/freeswitch/libs/nuance-asr-grpc-api \
&& LANGUAGE=cpp make -j 16 \
&& LANGUAGE=cpp make -j${BUILD_CPUS} \
&& cd /usr/local/src/freeswitch/libs/riva-asr-grpc-api \
&& LANGUAGE=cpp make -j 16 \
&& LANGUAGE=cpp make -j${BUILD_CPUS} \
&& cd /usr/local/src/freeswitch/libs/soniox-asr-grpc-api \
&& LANGUAGE=cpp make -j 16 \
&& LANGUAGE=cpp make -j${BUILD_CPUS} \
&& cd /usr/local/src/freeswitch/libs/cobalt-asr-grpc-api \
&& LANGUAGE=cpp make -j 16 \
&& LANGUAGE=cpp make -j${BUILD_CPUS} \
&& sed -i '/#ifndef cJSON_AS4CPP__h/i #ifndef cJSON__h\n#define cJSON__h' /usr/local/include/aws/core/external/cjson/cJSON.h \
&& echo '#endif' >> /usr/local/include/aws/core/external/cjson/cJSON.h \
&& cd /usr/local/src/freeswitch \
&& ./bootstrap.sh -j \
&& ./configure --enable-tcmalloc=yes --with-lws=yes --with-extra=yes --with-aws=yes \
&& make -j 16 \
&& make -j${BUILD_CPUS} \
&& make install \
&& cp /tmp/acl.conf.xml /usr/local/freeswitch/conf/autoload_configs \
&& cp /tmp/event_socket.conf.xml /usr/local/freeswitch/conf/autoload_configs \
Expand Down

0 comments on commit b8e1c92

Please sign in to comment.