-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build image and push to docker on merge (#113)
* build image and push to docker on merge * bug fix * bug fix * fix dockerfile * fix tags * added new line in build.yml Co-authored-by: Ryan Williams <ryan.williams@signalwire.com> * added new line in Dockerfile * remove ref: min/build-image from stack_image job --------- Co-authored-by: Aye Min Aung <ayemin@signalwire.com> Co-authored-by: Ryan Williams <ryan.williams@signalwire.com>
- Loading branch information
1 parent
d7c6efc
commit b8c354a
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "min/build-image" | ||
workflow_call: | ||
secrets: | ||
# Secrets used to build | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
GH_BOT_DEPLOY_KEY: | ||
required: true | ||
|
||
jobs: | ||
hash: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
HASH: ${{ steps.hash.outputs.short }} | ||
steps: | ||
- id: hash | ||
uses: pr-mpt/actions-commit-hash@v2 | ||
with: | ||
# NOTE: since this workflow is only triggered by `push` event | ||
# github.sha have correct commit sha | ||
commit: ${{ github.sha }} | ||
stack_image: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
LIBS10: ${{ steps.image.outputs.IMAGE_LIBS10 }} | ||
LIBS11: ${{ steps.image.outputs.IMAGE_LIBS11 }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: signalwire/libks | ||
path: /home/runner/work/signalwire-c/signalwire-c/libks | ||
- run: | | ||
cd /home/runner/work/signalwire-c/signalwire-c/libks | ||
export LIBKS_SHA=$(git rev-parse --short HEAD); | ||
export IMAGE_LIBS10="signalwire/freeswitch-libs:libks-libs10-$LIBKS_SHA" | ||
export IMAGE_LIBS11="signalwire/freeswitch-libs:libks-libs11-$LIBKS_SHA" | ||
echo "IMAGE_LIBS10=$IMAGE_LIBS10" >> $GITHUB_OUTPUT | ||
echo "IMAGE_LIBS11=$IMAGE_LIBS11" >> $GITHUB_OUTPUT | ||
id: image | ||
build: | ||
needs: [hash,stack_image] | ||
strategy: | ||
matrix: | ||
include: | ||
- tag: signalwire-c-libs10-${{ needs.hash.outputs.HASH }} | ||
baseimage: signalwire/freeswitch-base:debian-10 | ||
libks_image: ${{ needs.stack_image.outputs.LIBS10 }} | ||
- tag: signalwire-c-libs11-${{ needs.hash.outputs.HASH }} | ||
baseimage: signalwire/freeswitch-base:debian-11 | ||
libks_image: ${{ needs.stack_image.outputs.LIBS11 }} | ||
name: "build signalwire-c" | ||
uses: signalwire/actions-template/.github/workflows/ci-build.yml@main | ||
with: | ||
CONTAINER_SCAN: true | ||
CONTAINER_TEST: false | ||
PROJECT_NAME: "freeswitch-libs" | ||
FILE: ./Dockerfile | ||
PUSH: true | ||
RUNNER: ubuntu-latest | ||
TAG: ${{ matrix.tag }} | ||
BUILD_ARGS: | | ||
BASEIMAGE=${{ matrix.baseimage }} | ||
LIBKS_IMAGE=${{ matrix.libks_image }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG LIBKS_IMAGE=signalwire/freeswitch-libs:libks-libs10 | ||
ARG BASEIMAGE=signalwire/freeswitch-base:debian-10 | ||
FROM ${LIBKS_IMAGE} as libks | ||
FROM ${BASEIMAGE} | ||
|
||
COPY REVISION /REVISION | ||
COPY --from=libks /usr/lib/libks2.so /usr/lib/libks2.so | ||
COPY --from=libks /usr/lib/libks2.so.2 /usr/lib/libks2.so.2 | ||
COPY --from=libks /usr/lib/pkgconfig/libks2.pc /usr/lib/pkgconfig/libks2.pc | ||
COPY --from=libks /usr/include/libks2 /usr/include/libks2 | ||
RUN mkdir -p /sw/signalwire-c | ||
WORKDIR /sw/signalwire-c | ||
COPY . . | ||
|
||
RUN PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install |