Skip to content

Commit

Permalink
Update to version v1.13.4
Browse files Browse the repository at this point in the history
Add support for Jellyfin, reduce Docker image size, other minor changes and fixes
  • Loading branch information
CollinHeist authored Mar 18, 2023
2 parents 6d19bc4 + ee61634 commit 0eff11b
Show file tree
Hide file tree
Showing 56 changed files with 3,567 additions and 1,234 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: multi-build-docker
on:
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
DOCKER_HUB_USERNAME:
required: true
DOCKER_HUB_ACCESS_TOKEN:
required: true
GH_TOKEN:
required: true

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}

- name: Set up QEMU for ARM emulation
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and Push
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64 # edit this if you want to build more architectures
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/titlecardmaker:${{ inputs.tag }},ghcr.io/collinheist/titlecardmaker:${{ inputs.tag }}
42 changes: 7 additions & 35 deletions .github/workflows/docker_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,13 @@ name: Docker Develop Release
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:

docker-develop:
runs-on: ubuntu-latest
steps:

- name: Check Out Repo
uses: actions/checkout@v3
with:
ref: develop

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/titlecardmaker:develop
uses: ./.github/workflows/docker_build.yml
with:
tag: develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
44 changes: 8 additions & 36 deletions .github/workflows/docker_master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,13 @@ name: Docker Master Release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

docker-develop:
runs-on: ubuntu-latest
steps:

- name: Check Out Repo
uses: actions/checkout@v3
with:
ref: master

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/titlecardmaker:master
docker-master:
uses: ./.github/workflows/docker_build.yml
with:
tag: master
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
78 changes: 37 additions & 41 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
# syntax=docker/dockerfile:1
# Create pipenv image to convert Pipfile to requirements.txt
FROM python:3.9-slim as pipenv

# Set base image
# Copy Pipfile and Pipfile.lock
COPY Pipfile Pipfile.lock ./

# Install pipenv and convert to requirements.txt
RUN pip3 install --no-cache-dir --upgrade pipenv; \
pipenv requirements > requirements.txt

FROM python:3.9-slim as python-reqs

# Copy requirements.txt from pipenv stage
COPY --from=pipenv /requirements.txt requirements.txt

# Install gcc for building python dependencies; install TCM dependencies
RUN apt-get update; \
apt-get install -y gcc; \
pip3 install --no-cache-dir -r requirements.txt

# Set base image for running TCM
FROM python:3.9-slim
LABEL maintainer="CollinHeist"
LABEL description="Automated title card maker for Plex"
LABEL maintainer="CollinHeist" \
description="Automated title card maker for Plex"

# Set working directory, copy source into container
WORKDIR /maker
COPY . /maker

# Copy python packages from python-reqs
COPY --from=python-reqs /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages

# Script environment variables
ENV TCM_PREFERENCES=/config/preferences.yml
ENV TCM_IS_DOCKER=TRUE
ENV TCM_PREFERENCES=/config/preferences.yml \
TCM_IS_DOCKER=TRUE

# Delete setup files
# Create user and group to run the container
RUN groupadd -g 314 titlecardmaker; \
useradd -u 314 -g 314 titlecardmaker

# Install gosu
# Install gosu, imagemagick
# Clean up apt cache
# Override default ImageMagick policy XML file
RUN set -eux; \
rm -f Pipfile Pipfile.lock; \
groupadd -g 314 titlecardmaker; \
useradd -u 314 -g 314 titlecardmaker; \
apt-get update; \
apt-get install -y gosu; \
apt-get install -y --no-install-recommends gosu imagemagick; \
rm -rf /var/lib/apt/lists/*; \
gosu nobody true

# Intall OS dependencies
RUN apt-get update; \
apt-get upgrade -y --no-install-recommends; \
apt-get install -y gcc; \
apt update

# Install ImageMagick
RUN apt install -y imagemagick
RUN export MAGICK_HOME="$HOME/ImageMagick-7.1.0"; \
export PATH="$MAGICK_HOME/bin:$PATH"; \
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"

# Override default ImageMagick policy XML file
RUN cp /maker/modules/ref/policy.xml /etc/ImageMagick-6/policy.xml

# Install TCM package dependencies
RUN pip3 install --no-cache-dir --upgrade pipenv; \
pipenv requirements > requirements.txt; \
pip3 install -r requirements.txt

# Delete setup files
RUN rm -f Pipfile Pipfile.lock requirements.txt

# Uninstall OS dependencies
RUN apt-get autoremove --purge -y gcc; \
apt-get clean; \
apt-get autoclean
cp modules/ref/policy.xml /etc/ImageMagick-6/policy.xml

# Entrypoint
CMD ["python3", "main.py", "--run", "--no-color"]
ENTRYPOINT ["bash", "./start.sh"]
ENTRYPOINT ["bash", "./start.sh"]
Loading

0 comments on commit 0eff11b

Please sign in to comment.