Spaces:
Runtime error
Runtime error
# 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 | |
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 the Jellyfin repository, install Jellyfin | |
RUN wget -O - https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo apt-key add - && \ | |
echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/jellyfin.list && \ | |
sudo apt-get update && \ | |
sudo 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 git clone https://github.com/Osama-Yusuf/jellyfin-uploader.git /tmp/jellyfin-uploader && \ | |
pip3 install --no-cache-dir -r /tmp/jellyfin-uploader/requirements.txt | |
# 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/jellyfin-uploader && flask run --host=0.0.0.0 --port=7860"] |