Skip to content

Commit

Permalink
Fix multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
jstabenow committed Jan 26, 2024
1 parent d74438e commit 12ab148
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 14 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ node_modules/
.github
.github_build
.build
NONPUBLIC/
54 changes: 40 additions & 14 deletions .github/workflows/build_restreamer_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
name: 'Build datarhei/restreamer-ui:dev'
name: 'Build datarhei/restreamer-ui:dev-dev'

on:
#workflow_dispatch:
#workflow_call:
#push:
# branches:
# - dev
push:
branches:
- dev

jobs:
docker:
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '21'

- name: Build React App
run: |
yarn install
yarn build
- name: Upload React build as artifact
uses: actions/upload-artifact@v2
with:
name: react-build
path: build/

build-docker:
needs: build-frontend
runs-on: [self-hosted]
strategy:
matrix:
branch:
- dev
platform: [linux/amd64, linux/arm64, linux/arm/v7]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download React build artifact
uses: actions/download-artifact@v2
with:
ref: ${{ matrix.branch }}
name: react-build
path: build

- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
Expand All @@ -33,7 +57,8 @@ jobs:
images: |
datarhei/restreamer-ui
tags: |
type=raw,value=dev,enable=${{ matrix.branch == 'dev' }}
type=raw,value=dev-dev,enable=${{ matrix.platform == 'linux/amd64' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
Expand All @@ -50,22 +75,23 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Multi-Arch
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
file: ./Dockerfile.workflow
build-args: |
PUBLIC_URL=/ui
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/build

# misc
NONPUBLIC
.DS_Store
.VSCodeCounter
.env.local
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG CADDY_IMAGE=caddy:2.7.5-alpine
FROM $CADDY_IMAGE

COPY build /ui/build
COPY Caddyfile /ui/Caddyfile

WORKDIR /ui

EXPOSE 3000

CMD [ "caddy", "run", "--config", "/ui/Caddyfile" ]

0 comments on commit 12ab148

Please sign in to comment.