From 612ea7b9bbf9e09a6b68df9906fc1871ecbf30ef Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 8 Jan 2025 21:27:09 +1300 Subject: [PATCH] add separate version for cinesync dev Signed-off-by: David Young --- apps/cinesync/Dockerfile | 5 +-- apps/cinesync/dev/Dockerfile | 65 ++++++++++++++++++++++++++++++++++++ apps/cinesync/dev/goss.yaml | 18 ++++++++++ apps/cinesync/metadata.json | 13 +++++++- 4 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 apps/cinesync/dev/Dockerfile create mode 100644 apps/cinesync/dev/goss.yaml diff --git a/apps/cinesync/Dockerfile b/apps/cinesync/Dockerfile index 3b10cf9591..2b964ed186 100644 --- a/apps/cinesync/Dockerfile +++ b/apps/cinesync/Dockerfile @@ -5,10 +5,7 @@ ARG VERSION RUN apk update && apk upgrade && \ apk add --no-cache git -# RUN git clone -b CineSync-$VERSION https://github.com/sureshfizzy/CineSync.git /source - -# temporary fix -RUN git clone -b anime-fix https://github.com/sureshfizzy/CineSync.git /source +RUN git clone -b CineSync-$VERSION https://github.com/sureshfizzy/CineSync.git /source # Use an official Python runtime as a parent image FROM python:3.11-slim diff --git a/apps/cinesync/dev/Dockerfile b/apps/cinesync/dev/Dockerfile new file mode 100644 index 0000000000..3b10cf9591 --- /dev/null +++ b/apps/cinesync/dev/Dockerfile @@ -0,0 +1,65 @@ +# Get upstream code +FROM alpine:latest as cloner +ARG VERSION + +RUN apk update && apk upgrade && \ + apk add --no-cache git + +# RUN git clone -b CineSync-$VERSION https://github.com/sureshfizzy/CineSync.git /source + +# temporary fix +RUN git clone -b anime-fix https://github.com/sureshfizzy/CineSync.git /source + +# Use an official Python runtime as a parent image +FROM python:3.11-slim + +# Set the working directory inside the container +WORKDIR /app + +# Install required packages +RUN apt-get update && \ + apt-get install -y inotify-tools tmux bash dialog && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Copy the requirements file and install dependencies +COPY --from=cloner /source/requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the entire project to the container's working directory +COPY --from=cloner /source/MediaHub /app/MediaHub +COPY --from=cloner /source/.env ./ + +# Set PYTHONPATH to include the MediaHub directory +ENV PYTHONPATH=/app/MediaHub + +# Set environment variables from the .env file +RUN export $(grep -v '^#' .env | xargs -d '\n' -I {} echo "ENV {}") + +# fix for goss, will be overridden in chart +ENV DESTINATION_DIR=/tmp +ENV SOURCE_DIR=/tmp + +# Create necessary directories +RUN mkdir -p /app/db + +# Set environment variables for PUID and PGID +ENV PUID=1000 +ENV PGID=1000 + +# Add ttyd +ADD --chmod=755 https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 /usr/local/bin/ttyd +# add local files +COPY --chown=568:568 apps/cinesync/cinesync.sh / +COPY --chown=568:568 apps/cinesync/launch-tmux.sh / +COPY --chown=568:568 apps/cinesync/entrypoint.sh / +COPY --chown=568:568 apps/cinesync/restricted.tmux.conf / + +# Force our preferred user +ARG user=elfie +RUN groupadd -g 568 $user && useradd -d /app/db --create-home --uid 568 --gid 568 --shell /bin/bash $user +RUN chown elfie /app/db +USER 568 + +# Run the application +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/apps/cinesync/dev/goss.yaml b/apps/cinesync/dev/goss.yaml new file mode 100644 index 0000000000..b23ef78250 --- /dev/null +++ b/apps/cinesync/dev/goss.yaml @@ -0,0 +1,18 @@ +--- +# https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#process +process: + python3: + running: true + ttyd: + running: true + +# https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#port +port: + # https://github.com/aelsabbahy/goss/issues/149 + tcp:3001: + listening: true + +# https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#http +http: + http://localhost:3001: + status: 200 \ No newline at end of file diff --git a/apps/cinesync/metadata.json b/apps/cinesync/metadata.json index 535334e147..6355b921b5 100644 --- a/apps/cinesync/metadata.json +++ b/apps/cinesync/metadata.json @@ -12,6 +12,17 @@ "enabled": false, "type": "web" } - } + }, + { + "name": "dev", + "platforms": [ + "linux/amd64" + ], + "stable": false, + "tests": { + "enabled": false, + "type": "web" + } + } ] }