Updated build workflow and Dockerfile

This commit is contained in:
Phin 2023-11-06 16:43:28 +05:30
parent 453855b1c3
commit ba0129e99a
3 changed files with 12 additions and 15 deletions

View file

@ -1,29 +1,24 @@
name: Release name: Release
run-name: Release ${{ inputs.version || github.ref_name }} run-name: Release ${{ github.ref_name }}
on: on:
push: push:
tags: tags:
- v* - v*
workflow_dispatch: workflow_dispatch:
inputs:
version:
required: true
type: string
description: Version (vX.X.X)
env: env:
VERSION: ${{ inputs.version || github.ref_name }} DOCKER_IMAGE_NAME: ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}
jobs: jobs:
release-zip: release-zip:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
env: env:
RELEASE_ZIP_FILENAME: ${{ github.event.repository.name }}-${{ inputs.version || github.ref_name }}.zip RELEASE_ZIP_FILENAME: ${{ github.event.repository.name }}-${{ github.ref_name }}.zip
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Create release ZIP file - name: Create release ZIP file
run: | run: |-
mkdir ${{ github.event.repository.name }} mkdir ${{ github.event.repository.name }}
rm -rf .git .github .gitignore .dockerignore Dockerfile CONTRIBUTING.md pyrightconfig.json rm -rf .git .github .gitignore .dockerignore Dockerfile CONTRIBUTING.md pyrightconfig.json
mv * ${{ github.event.repository.name }} || true mv * ${{ github.event.repository.name }} || true
@ -31,15 +26,14 @@ jobs:
- name: Release on GitHub - name: Release on GitHub
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with: with:
tag_name: ${{ env.VERSION }}
generate_release_notes: true generate_release_notes: true
files: ${{ env.RELEASE_ZIP_FILENAME }} files: ${{ env.RELEASE_ZIP_FILENAME }}
body: |-
Docker Image: [${{ env.DOCKER_IMAGE_NAME }}](https://${{ env.DOCKER_IMAGE_NAME }})
release-docker: release-docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write packages: write
env:
DOCKER_IMAGE_NAME: ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -55,7 +49,7 @@ jobs:
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/i386,linux/arm
push: true push: true
provenance: false provenance: false
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ env.VERSION }},${{ env.DOCKER_IMAGE_NAME }}:latest tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }},${{ env.DOCKER_IMAGE_NAME }}:latest

View file

@ -1,4 +1,7 @@
FROM python:3.10-alpine FROM python:3.10-alpine
ARG TARGETOS
ARG TARGETARCH
RUN OSARCH="$TARGETOS-$TARGETARCH"; if [[ "$OSARCH" = "linux-386" || "$OSARCH" = "linux-arm" ]]; then apk --no-cache add build-base python3 python3-dev python3-tkinter openssl bash git meson py3-pip sudo freetype-dev fribidi-dev harfbuzz-dev jpeg-dev lcms2-dev libimagequant-dev openjpeg-dev tcl-dev tiff-dev tk-dev zlib-dev; fi
ARG USERNAME=app ARG USERNAME=app
ARG USER_UID_GID=10000 ARG USER_UID_GID=10000
RUN addgroup -g $USER_UID_GID $USERNAME && adduser -u $USER_UID_GID -G $USERNAME -D $USERNAME RUN addgroup -g $USER_UID_GID $USERNAME && adduser -u $USER_UID_GID -G $USERNAME -D $USERNAME

View file

@ -32,7 +32,7 @@ from core.discord import DiscordIpcService
from core.plex import PlexAlertListener, initiateAuth, getAuthToken from core.plex import PlexAlertListener, initiateAuth, getAuthToken
from typing import Optional from typing import Optional
from utils.cache import loadCache from utils.cache import loadCache
from utils.logging import formatter, logger from utils.logging import logger, formatter
from utils.text import formatSeconds from utils.text import formatSeconds
import logging import logging
import models.config import models.config