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
.github_build .github_build
.build .build
NONPUBLIC/

View File

@ -1,25 +1,49 @@
name: 'Build datarhei/restreamer-ui:dev' name: 'Build datarhei/restreamer-ui:dev-dev'
on: on:
#workflow_dispatch: push:
#workflow_call: branches:
#push: - dev
# branches:
# - dev
jobs: 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] runs-on: [self-hosted]
strategy: strategy:
matrix: matrix:
branch: platform: [linux/amd64, linux/arm64, linux/arm/v7]
- dev
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Download React build artifact
uses: actions/download-artifact@v2
with: with:
ref: ${{ matrix.branch }} name: react-build
path: build
- uses: actions-ecosystem/action-get-latest-tag@v1 - uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag id: get-latest-tag
@ -33,7 +57,8 @@ jobs:
images: | images: |
datarhei/restreamer-ui datarhei/restreamer-ui
tags: | tags: |
type=raw,value=dev,enable=${{ matrix.branch == 'dev' }} type=raw,value=dev-dev,enable=${{ matrix.platform == 'linux/amd64' }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@master uses: docker/setup-qemu-action@master
with: with:
@ -50,6 +75,7 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -57,15 +83,15 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Multi-Arch - name: Build and Push Docker Image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
context: . context: .
file: ./Dockerfile file: ./Dockerfile.workflow
build-args: | build-args: |
PUBLIC_URL=/ui PUBLIC_URL=/ui
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: ${{ matrix.platform }}
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
/build /build
# misc # misc
NONPUBLIC
.DS_Store .DS_Store
.VSCodeCounter .VSCodeCounter
.env.local .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" ]