Fix multiarch build

This commit is contained in:
Jan Stabenow 2024-01-26 12:51:12 +01:00
parent d74438e300
commit 12ab148f47
4 changed files with 53 additions and 14 deletions

View File

@ -10,3 +10,4 @@ node_modules/
.github
.github_build
.build
NONPUBLIC/

View File

@ -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
@ -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:
@ -50,6 +75,7 @@ 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
@ -57,15 +83,15 @@ jobs:
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 }}

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
/build
# misc
NONPUBLIC
.DS_Store
.VSCodeCounter
.env.local

11
Dockerfile.workflow Normal file
View File

@ -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" ]