Skip to content

Commit

Permalink
fix(ci): Builds docker images for both supported arches
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Thomas <taylor@cosmonic.com>
  • Loading branch information
thomastaylor312 authored and ricochet committed May 24, 2023
1 parent fd64534 commit 6f826bd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
50 changes: 22 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,25 +333,12 @@ jobs:
# ```
# Error: buildx failed with: ERROR: invalid tag "wasmcloud.azurecr.io/wasmcloud_host:616/merge": invalid reference format
# ```
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
if: startswith(github.ref, 'refs/tags/')
strategy:
matrix:
config:
- app-name: host_core
target: aarch64_linux_gnu
platform: linux/arm64

- app-name: host_core
target: x86_64_linux_gnu
platform: linux/amd64

- app-name: wasmcloud_host
target: aarch64_linux_gnu
platform: linux/arm64

- app-name: wasmcloud_host
target: x86_64_linux_gnu
platform: linux/amd64
app-name:
- host_core
- wasmcloud_host

runs-on: ubuntu-22.04
needs:
Expand Down Expand Up @@ -386,25 +373,32 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: ${{ matrix.config.app-name }}_${{ matrix.config.target }}
path: ${{ matrix.config.app-name }}
- run: chmod +x ${{ matrix.config.app-name }}/${{ matrix.config.app-name }}_${{ matrix.config.target }}
name: ${{ matrix.app-name }}_aarch64_linux_gnu
path: ${{ matrix.app-name }}
- run: chmod +x ${{ matrix.app-name }}/${{ matrix.app-name }}_aarch64_linux_gnu

- uses: actions/download-artifact@v3
with:
name: ${{ matrix.app-name }}_x86_64_linux_gnu
path: ${{ matrix.app-name }}
- run: chmod +x ${{ matrix.app-name }}/${{ matrix.app-name }}_x86_64_linux_gnu

- name: Build and release docker image
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx-builder.outputs.name }}
push: ${{ startswith(github.ref, 'refs/tags/') }}
context: ${{ matrix.config.app-name }}
file: ${{ matrix.config.app-name }}/Dockerfile
platforms: ${{ matrix.config.platform }}
context: ${{ matrix.app-name }}
file: ${{ matrix.app-name }}/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
BIN=${{ matrix.config.app-name }}_${{ matrix.config.target }}
BIN_ARM64=${{ matrix.app-name }}_aarch64_linux_gnu
BIN_AMD64=${{ matrix.app-name }}_x86_64_linux_gnu
tags: |
wasmcloud.azurecr.io/${{ matrix.config.app-name }}:${{ env.app-version }}
wasmcloud.azurecr.io/${{ matrix.config.app-name }}:latest
wasmcloud/${{ matrix.config.app-name }}:${{ env.app-version }}
wasmcloud/${{ matrix.config.app-name }}:latest
wasmcloud.azurecr.io/${{ matrix.app-name }}:${{ env.app-version }}
wasmcloud/${{ matrix.app-name }}:${{ env.app-version }}
wasmcloud.azurecr.io/${{ matrix.app-name }}:latest
wasmcloud/${{ matrix.app-name }}:latest
github-release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
Expand Down
13 changes: 11 additions & 2 deletions host_core/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
FROM debian:bullseye-slim
FROM debian:bullseye-slim AS base

FROM base AS base-amd64
ARG BIN_AMD64
ARG BIN=$BIN_AMD64

FROM base AS base-arm64
ARG BIN_ARM64
ARG BIN=$BIN_ARM64

FROM base-$TARGETARCH

# Install runtime dependencies
RUN apt update && \
apt install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*

ARG BIN
COPY ${BIN} /usr/local/bin/host_core

RUN host_core maintenance install
Expand Down
13 changes: 11 additions & 2 deletions wasmcloud_host/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
FROM debian:bullseye-slim
FROM debian:bullseye-slim AS base

FROM base AS base-amd64
ARG BIN_AMD64
ARG BIN=$BIN_AMD64

FROM base AS base-arm64
ARG BIN_ARM64
ARG BIN=$BIN_ARM64

FROM base-$TARGETARCH

# Install runtime dependencies
RUN apt update && \
apt install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*

ARG BIN
COPY ${BIN} /usr/local/bin/wasmcloud_host

RUN wasmcloud_host maintenance install
Expand Down

0 comments on commit 6f826bd

Please sign in to comment.