Skip to content

Commit

Permalink
ci/dev: add multi-platform image build (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers authored Oct 29, 2024
1 parent 2507353 commit 08782bc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
59 changes: 34 additions & 25 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: |
docker build libre -t libre-dev \
--build-arg VERSION=${{ env.VERSION_RE }}
- name: Tag and Push image
if: github.event_name != 'pull_request'
run: |
docker tag libre-dev ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_RE }}
docker tag libre-dev ghcr.io/${{ env.IMAGE_NAME }}:latest
docker push ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_RE }}
docker push ghcr.io/${{ env.IMAGE_NAME }}:latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: libre
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_RE }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
build-args: VERSION=${{ env.VERSION_RE }}

baresip-dev:
env:
Expand All @@ -53,23 +57,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: |
docker build baresip -t baresip-dev \
--build-arg VERSION=${{ env.VERSION_BARESIP }} \
--build-arg IMAGE=ghcr.io/baresip/docker/libre-dev:latest
- name: Tag and Push image
if: github.event_name != 'pull_request'
run: |
docker tag baresip-dev ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_BARESIP }}
docker tag baresip-dev ghcr.io/${{ env.IMAGE_NAME }}:latest
docker push ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_BARESIP }}
docker push ghcr.io/${{ env.IMAGE_NAME }}:latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: baresip
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION_BARESIP }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
build-args: |
VERSION=${{ env.VERSION_BARESIP }}
IMAGE=ghcr.io/baresip/docker/libre-dev:latest
2 changes: 1 addition & 1 deletion baresip/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN git clone -b ${VERSION} --depth=1 https://github.com/baresip/baresip.git &&
cd baresip && \
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-g" -DCMAKE_CXX_FLAGS="-g" -DCMAKE_C_COMPILER=clang-15 \
-DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_INSTALL_PREFIX=/usr && \
cmake --build build -j && \
cmake --build build -j4 && \
cmake --install build --prefix dist && cp -a dist/* /usr/
RUN mkdir -p /root/dist/usr && \
cp -a /root/re/dist/* /root/dist/usr/ && \
Expand Down
2 changes: 1 addition & 1 deletion libre/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN install_packages clang-15 make cmake pkg-config git libssl-dev wget ca-certi
git clone -b ${VERSION} --depth=1 https://github.com/baresip/re.git && \
cd re && \
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-g" -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 && \
cmake --build build -j && \
cmake --build build -j4 && \
cmake --install build --prefix dist && cp -a dist/* /usr/

0 comments on commit 08782bc

Please sign in to comment.