jellyspace / Dockerfile
ChandimaPrabath's picture
Update Dockerfile
a343e4e verified
# Base image with CUDA support
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
# Set non-interactive mode for apt
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Europe/Paris
# Remove any third-party apt sources to avoid issues with expiring keys.
# Install basic utilities and Cloudflared
RUN rm -f /etc/apt/sources.list.d/*.list && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
sudo \
git \
wget \
procps \
git-lfs \
zip \
unzip \
htop \
vim \
nano \
bzip2 \
libx11-6 \
build-essential \
software-properties-common \
python3-pip \
&& rm -rf /var/lib/apt/lists/* && \
# Add Cloudflare GPG key
mkdir -p --mode=0755 /usr/share/keyrings && \
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null && \
# Add Cloudflare repository
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared jammy main' | tee /etc/apt/sources.list.d/cloudflared.list && \
# Install Cloudflared
apt-get update && apt-get install -y cloudflared
# Add the Jellyfin repository and install Jellyfin
RUN wget -O - https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | apt-key add - && \
echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/ubuntu focal main" | tee /etc/apt/sources.list.d/jellyfin.list && \
apt-get update && \
apt-get install -y jellyfin
# Create a working directory
WORKDIR /tmp/app
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
&& chown -R user:user /tmp/app
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# All users can use /home/user as their home directory
ENV HOME=/home/user
RUN mkdir $HOME/.cache $HOME/.config \
&& chmod -R 777 $HOME
# Clone the jellyfin-uploader repository and install its requirements
USER root
RUN pip3 install --no-cache-dir gradio
# Copy the current directory contents into the container at /tmp/app, setting the owner to the user
COPY --chown=user . /tmp/app
# Environment variables for Jellyfin
ENV PYTHONUNBUFFERED=1 \
SYSTEM=spaces \
SHELL=/bin/bash
# Expose ports for Jellyfin and the Flask server
EXPOSE 8096
EXPOSE 7860
# Start Jellyfin and the Flask server
USER user
CMD ["sh", "-c", "jellyfin -d /home/user/app/jellyfin --webdir /usr/share/jellyfin/web & cd /tmp/app && python3 app.py & cloudflared tunnel --url localhost:7860"]