-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
executable file
·58 lines (45 loc) · 1.73 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ARG PYVERSION=3.11
# Create pipenv image to convert Pipfile to requirements.txt
FROM python:${PYVERSION}-slim as pipenv
# 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:${PYVERSION}-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:${PYVERSION}-slim
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
# update with python version
COPY --from=python-reqs /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
# Script environment variables
ENV TCM_PREFERENCES=/config/preferences.yml \
TCM_IS_DOCKER=TRUE
# Delete setup files
# Create user and group to run the container
# Install imagemagick
# Clean up apt cache
# Override default ImageMagick policy XML file
RUN set -eux; \
rm -f Pipfile Pipfile.lock; \
groupadd -g 99 titlecardmaker; \
useradd -u 100 -g 99 titlecardmaker; \
apt-get update; \
apt-get install -y --no-install-recommends imagemagick libmagickcore-6.q16-6-extra; \
rm -rf /var/lib/apt/lists/*; \
cp modules/ref/policy.xml /etc/ImageMagick-6/policy.xml
VOLUME [ "/config" ]
# Entrypoint
CMD ["python3", "main.py", "--run", "--no-color"]
ENTRYPOINT ["bash", "./start.sh"]