From ba0129e99a79a10771ec80f6934dadcaa214059f Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:43:28 +0530 Subject: [PATCH] Updated build workflow and Dockerfile --- .github/workflows/release.yml | 22 ++++++++-------------- Dockerfile | 3 +++ main.py | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf2437a..37d6915 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,24 @@ name: Release -run-name: Release ${{ inputs.version || github.ref_name }} +run-name: Release ${{ github.ref_name }} on: push: tags: - v* workflow_dispatch: - inputs: - version: - required: true - type: string - description: Version (vX.X.X) env: - VERSION: ${{ inputs.version || github.ref_name }} + DOCKER_IMAGE_NAME: ghcr.io/${{ github.actor }}/${{ github.event.repository.name }} jobs: release-zip: runs-on: ubuntu-latest permissions: contents: write 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: - name: Checkout repository uses: actions/checkout@v4 - name: Create release ZIP file - run: | + run: |- mkdir ${{ github.event.repository.name }} rm -rf .git .github .gitignore .dockerignore Dockerfile CONTRIBUTING.md pyrightconfig.json mv * ${{ github.event.repository.name }} || true @@ -31,15 +26,14 @@ jobs: - name: Release on GitHub uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 with: - tag_name: ${{ env.VERSION }} generate_release_notes: true files: ${{ env.RELEASE_ZIP_FILENAME }} + body: |- + Docker Image: [${{ env.DOCKER_IMAGE_NAME }}](https://${{ env.DOCKER_IMAGE_NAME }}) release-docker: runs-on: ubuntu-latest permissions: packages: write - env: - DOCKER_IMAGE_NAME: ghcr.io/${{ github.actor }}/${{ github.event.repository.name }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -55,7 +49,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/arm64,linux/i386,linux/arm push: true 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 diff --git a/Dockerfile b/Dockerfile index 48be762..174710a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ 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 USER_UID_GID=10000 RUN addgroup -g $USER_UID_GID $USERNAME && adduser -u $USER_UID_GID -G $USERNAME -D $USERNAME diff --git a/main.py b/main.py index b07d9b7..6dcfe80 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,7 @@ from core.discord import DiscordIpcService from core.plex import PlexAlertListener, initiateAuth, getAuthToken from typing import Optional from utils.cache import loadCache -from utils.logging import formatter, logger +from utils.logging import logger, formatter from utils.text import formatSeconds import logging import models.config