Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiarch Playnite Web Docker Images #326

Merged
merged 9 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ jobs:
env:
REGISTRY: ghcr.io
OWNER: andrew-codes
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
steps:
- uses: actions/checkout@v4
- name: Extract major release version from package.json
Expand Down Expand Up @@ -74,16 +82,16 @@ jobs:
registry: ${{ env.REGISTRY}}
username: ${{ env.OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish apps
run: yarn nx run-many --target=publish --parallel --verbose
env:
NODE_ENV: production
DEBUG: 'playnite-web/*'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packaged-apps
path: apps/*/_packaged/**
PLATFORM: ${{ matrix.platform }}

unit_tests_windows:
name: Verify PR - Tests (Windows)
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
OWNER: andrew-codes
REPO_NAME: playnite-web
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64

steps:
- name: Checkout
Expand Down Expand Up @@ -80,10 +88,15 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ env.OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish specific version for apps
run: yarn nx run-many --target=publish --parallel --verbose --all
env:
NODE_ENV: production
PLATFORM: ${{ matrix.platform }}

package:
name: Publish Extension
Expand Down Expand Up @@ -122,11 +135,6 @@ jobs:
NODE_ENV: production
- name: Move artifacts
run: mkdir -p _packaged && mv apps/*/_packaged/** _packaged/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: playnite-extension
path: _packaged/**

release:
name: Release
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/pull-request-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ jobs:
REGISTRY: ghcr.io
OWNER: andrew-codes
REPO_NAME: playnite-web
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -75,17 +83,16 @@ jobs:
run: corepack enable && corepack prepare --activate yarn@${{ steps.yarn_version.outputs.value }}
- name: Install deps
run: yarn
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish apps
run: yarn nx affected --base=origin/main --head=HEAD --target=package --parallel --verbose --exclude='*,!tag:linux'
env:
NODE_ENV: production
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packaged-apps
path: apps/*/_packaged/**
DEBUG: 'playnite-web/*'
PLATFORM: ${{ matrix.platform }}

unit_tests_windows:
name: Verify PR - Tests (Windows)
Expand Down
4 changes: 2 additions & 2 deletions apps/game-db-updater/scripts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pkg from '../package.json'
async function run() {
sh.cp('-R', '.dist/', '_packaged/')

const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand All @@ -15,7 +15,7 @@ async function run() {

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile .`,
`docker build --platform ${PLATFORM} --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile .`,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/game-db-updater/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand Down
4 changes: 2 additions & 2 deletions apps/playnite-web/scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function run() {
sh.cp('server.production.js', '_packaged/')
sh.cp('-R', 'public/', '_packaged/')

const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand All @@ -17,7 +17,7 @@ async function run() {

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile .`,
`docker build --platform ${PLATFORM} --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile .`,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/playnite-web/scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDockerTags } from 'versioning'
import pkg from '../package.json' assert { type: 'json' }

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand Down
4 changes: 2 additions & 2 deletions hass-game-db-updater/scripts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pkg from '../package.json'
async function run() {
sh.cp('-R', '.dist/', '_packaged/')

const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand All @@ -15,7 +15,7 @@ async function run() {

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile --build-arg VERSION=${tag} .`,
`docker build --platform ${PLATFORM} --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile --build-arg VERSION=${tag} .`,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion hass-game-db-updater/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand Down
4 changes: 2 additions & 2 deletions hass-playnite-web/scripts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pkg from '../package.json'
async function run() {
sh.cp('-R', '.dist/', '_packaged/')

const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand All @@ -15,7 +15,7 @@ async function run() {

for (const tag of tags) {
sh.exec(
`docker build --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile --build-arg VERSION=${tag} .`,
`docker build --platform ${PLATFORM} --tag "${REGISTRY}/${OWNER}/${pkg.name}:${tag}" --file Dockerfile --build-arg VERSION=${tag} .`,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion hass-playnite-web/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDockerTags } from 'versioning'
import pkg from '../package.json'

async function run() {
const { REGISTRY, OWNER, GITHUB_REF } = process.env
const { REGISTRY, OWNER, GITHUB_REF, PLATFORM } = process.env

if (!REGISTRY || !OWNER || !GITHUB_REF) {
throw new Error('Missing environment variables')
Expand Down