This commit is contained in:
SergeantPanda 2025-03-03 18:51:09 -06:00
commit c318b52f10
4 changed files with 26 additions and 56 deletions

View file

@ -119,12 +119,11 @@ USE_I18N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles' # Directory where static files will be collected
STATIC_ROOT = BASE_DIR / 'static' # Directory where static files will be collected
# Adjust STATICFILES_DIRS to include the paths to the directories that contain your static files.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'frontend/build/static'), # React build static files
BASE_DIR / 'static', # Django custom static files (if any)
]
@ -142,6 +141,7 @@ SERVER_IP = "127.0.0.1"
CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_CREDENTIALS = True
CSRF_TRUSTED_ORIGINS = ['*']
APPEND_SLASH = True
REST_FRAMEWORK = {

View file

@ -24,20 +24,13 @@ RUN apt-get update && \
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 && \
python manage.py collectstatic --noinput && \
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
find . -maxdepth 1 ! -name '.' ! -name 'build' -exec rm -rf '{}' \;
FROM python:3.13-slim
@ -51,51 +44,35 @@ COPY --from=builder /dispatcharrpy /dispatcharrpy
COPY --from=builder /app /app
RUN apt-get update && \
apt-get install -y \
apt-get install -y --no-install-recommends \
curl \
ffmpeg \
gcc \
git \
gnupg2 \
gpg \
libpq-dev \
lsb-release \
python3-virtualenv \
streamlink
RUN \
curl -sL https://deb.nodesource.com/setup_23.x -o /tmp/nodesource_setup.sh && \
bash /tmp/nodesource_setup.sh && \
nginx \
procps \
streamlink \
wget && \
cp /app/docker/nginx.conf /etc/nginx/sites-enabled/default && \
echo "=== setting up postgres ====" && \
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 - && \
echo "=== setting up redis ===" && \
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
RUN apt-get update && \
apt-get install -y \
nodejs \
redis
RUN \
postgresql-14 \
postgresql-contrib-14 \
redis-server && \
mkdir /data && \
virtualenv /dispatcharrpy && \
git clone https://github.com/Dispatcharr/Dispatcharr /app && \
cd /app && \
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 && \
apt-get remove -y \
gcc \
git \
gnupg2 \
gpg \
libpq-dev \
lsb-release \
nodejs && \
lsb-release && \
apt-get clean && \
apt-get autoremove -y && \
rm -rf \
@ -105,4 +82,4 @@ RUN \
WORKDIR /app
CMD ["/app/docker/entrypoint.aio.sh"]
CMD ["/app/docker/entrypoint.sh"]

View file

@ -1,15 +1,14 @@
services:
dispatcharr:
# build:
# context: ..
# dockerfile: docker/Dockerfile.alpine
image: dispatcharr/dispatcharr
# context: .
# dockerfile: Dockerfile
image: dekzter/dispactharr
container_name: dispatcharr
ports:
- 9191:9191
volumes:
- /home/ghost/code/Dispatcharr/docker/entrypoint.sh:/app/docker/entrypoint.sh
# - dispatcharr_db:/app/data/db
- dispatcharr_db:/app/data/db
environment:
- DISPATCHARR_ENV=aio
- REDIS_HOST=localhost

View file

@ -198,13 +198,7 @@ fi
cd /app
echo_with_timestamp "Running Django commands..."
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
# Always start Gunicorn
echo "🚀 Starting Gunicorn..."