merged in main

This commit is contained in:
dekzter 2025-03-03 17:13:54 -05:00
parent b5cc5dcb37
commit 857d62db28
6 changed files with 53 additions and 139 deletions

View file

@ -1,3 +1,44 @@
FROM python:3.13-slim AS builder
ENV PATH="/dispatcharrpy/bin:$PATH" \
VIRTUAL_ENV=/dispatcharrpy \
DJANGO_SETTINGS_MODULE=dispatcharr.settings \
PYTHONUNBUFFERED=1
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
gcc \
git \
wget && \
echo "=== setting up nodejs ===" && \
curl -sL https://deb.nodesource.com/setup_23.x -o /tmp/nodesource_setup.sh && \
bash /tmp/nodesource_setup.sh && \
apt-get update && \
apt-get install -y --no-install-recommends \
nodejs && \
python -m pip install virtualenv && \
virtualenv /dispatcharrpy && \
git clone https://github.com/Dispatcharr/Dispatcharr /app && \
cd /app && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir -r requirements-pytorch.txt && \
pip install --no-cache-dir -r requirements-sentence-transformers.txt && \
echo "installing sentence-transformers" && \
pip install sentence-transformers==3.4.1 && \
python manage.py collectstatic --noinput || true && \
cd /app/frontend && \
npm install && \
npm run build && \
find . -maxdepth 1 ! -name '.' ! -name 'build' -exec rm -rf '{}' \; && \
echo "Aggressively remove build-only packages and caches" && \
apt-get purge -y \
curl \
gcc \
git \
nodejs \
wget
FROM python:3.13-slim
ENV PATH="/dispatcharrpy/bin:$PATH" \
@ -5,6 +46,10 @@ ENV PATH="/dispatcharrpy/bin:$PATH" \
DJANGO_SETTINGS_MODULE=dispatcharr.settings \
PYTHONUNBUFFERED=1
# Copy the virtual environment and application from the builder stage
COPY --from=builder /dispatcharrpy /dispatcharrpy
COPY --from=builder /app /app
RUN apt-get update && \
apt-get install -y \
curl \
@ -23,6 +68,7 @@ RUN \
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && \
chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list && \
cp /app/docker/nginx.conf /etc/nginx/sites-enabled/default && \
apt-get update && \
apt-get install -y redis

View file

@ -1,54 +0,0 @@
FROM alpine
ENV PATH="/dispatcharrpy/bin:$PATH" \
VIRTUAL_ENV=/dispatcharrpy \
DJANGO_SETTINGS_MODULE=dispatcharr.settings \
PYTHONUNBUFFERED=1
RUN apk add \
python3 \
python3-dev \
gcc \
musl-dev \
linux-headers \
py3-pip \
ffmpeg \
streamlink \
vlc \
libpq-dev \
gcc \
py3-virtualenv \
uwsgi \
uwsgi-python \
nodejs \
npm \
git \
redis
RUN \
mkdir /data && \
virtualenv /dispatcharrpy && \
git clone https://github.com/Dispatcharr/Dispatcharr /app && \
cd /app && \
/dispatcharrpy/bin/pip install --no-cache-dir -r requirements.txt && \
cd /app/frontend && \
npm install && \
npm run build && \
find . -maxdepth 1 ! -name '.' ! -name 'build' -exec rm -rf '{}' \; && \
cd /app && \
python manage.py collectstatic --noinput || true
# Cleanup
RUN \
apk del \
nodejs \
npm \
git \
gcc \
musl-dev \
python3-dev \
linux-headers
WORKDIR /app
CMD ["/app/docker/entrypoint.aio.sh"]

View file

@ -1,68 +0,0 @@
FROM python:3.10-slim
ENV API_PORT=5656
# Add PostgreSQL repository
RUN apt-get update && apt-get install -y wget gnupg2 && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# Install required packages
RUN apt-get update && apt-get install -y \
ffmpeg \
streamlink \
vlc \
libpq-dev \
gcc \
postgresql-14 \
postgresql-contrib-14 \
redis-server \
npm \
nodejs \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy requirements.txt from the parent directory
COPY requirements.txt /app/
# Install Python dependencies
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy the application source code from the parent directory
COPY . /app/
# Build frontend react
RUN cd /app/frontend && \
npm install && \
npm run build && \
find . -maxdepth 1 ! -name '.' ! -name 'build' -exec rm -rf '{}' \; && \
cd /app && \
python manage.py collectstatic --noinput || true
# Cleanup
RUN apt-get purge -y \
nodejs \
npm \
gcc \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV DJANGO_SETTINGS_MODULE=dispatcharr.settings
ENV PYTHONUNBUFFERED=1
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
# Copy the entrypoint script
COPY docker/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Expose the port
EXPOSE 9191
# Command to run the startup script
CMD ["/app/entrypoint.sh"]

View file

@ -8,12 +8,12 @@ services:
ports:
- 9191:9191
volumes:
- dispatcharr:/data
- /home/ghost/code/Dispatcharr/docker/entrypoint.sh:/app/docker/entrypoint.sh
# - dispatcharr_db:/app/data/db
environment:
- DISPATHCARR_ENV=aio
- DB_ENGINE=sqlite
- DISPATCHARR_ENV=aio
- REDIS_HOST=localhost
- CELERY_BROKER_URL=redis://localhost:6379/0
volumes:
dispatcharr:
dispatcharr_db:

View file

@ -15,13 +15,9 @@ export POSTGRES_HOST=${POSTGRES_HOST:-localhost}
export POSTGRES_PORT=${POSTGRES_PORT:-5432}
export PUID=${PUID:-1000}
export PGID=${PGID:-1000}
export DJANGO_SUPERUSER_USERNAME=${DEFAULT_USERNAME:-admin}
export DJANGO_SUPERUSER_PASSWORD=${DEFAULT_PASSWORD:-admin}
export DJANGO_SUPERUSER_EMAIL=${DEFAULT_EMAIL:-admin@dispatcharr.local}
export PGDATA=${PGDATA:-/app/data/db}
export PG_BINDIR="/usr/lib/postgresql/14/bin"
# Echo environment variables for debugging
echo_with_timestamp "POSTGRES_DB: $POSTGRES_DB"
echo_with_timestamp "POSTGRES_USER: $POSTGRES_USER"
@ -117,13 +113,7 @@ echo_with_timestamp "Running Django commands..."
python manage.py collectstatic --noinput || true
python manage.py makemigrations --noinput || true
python manage.py migrate --noinput || true
echo_with_timestamp "Checking if Django superuser exists..."
if ! python manage.py shell -c "from django.contrib.auth import get_user_model; exit(0) if get_user_model().objects.filter(username='${DJANGO_SUPERUSER_USERNAME}').exists() else exit(1)"; then
echo_with_timestamp "Superuser does not exist. Creating..."
python manage.py createsuperuser --noinput || true
else
echo_with_timestamp "Superuser already exists. Skipping creation."
fi
python manage.py collectstatic --noinput || true
# Start Celery
echo_with_timestamp "Starting Celery..."

View file

@ -24,7 +24,7 @@ import {
SwapVert as SwapVertIcon,
LiveTv as LiveTvIcon,
ContentCopy,
Tv as TvIcon, // <-- ADD THIS IMPORT
Tv as TvIcon, // <-- ADD THIS IMPORT
} from '@mui/icons-material';
import API from '../../api';
import ChannelForm from '../forms/Channel';
@ -104,7 +104,7 @@ const ChannelsTable = () => {
};
function handleWatchStream(channelNumber) {
showVideo(`/output/stream/${channelNumber}/`);
showVideo(`http://192.168.1.151:5656/output/stream/${channelNumber}/`);
}
// (Optional) bulk delete, but your endpoint is @TODO