whispertube_backend / Dockerfile
uzi007's picture
Docker File Updated
4d4a1ff
# Use an appropriate base image with Ubuntu
FROM nvidia/cuda:11.2.2-base-ubuntu20.04
# Set environment variables for CUDA
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=$CUDA_HOME/bin:$PATH
ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
# Set DEBIAN_FRONTEND to noninteractive to prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# # Install NVIDIA driver
# RUN apt-get update && apt-get install -y --no-install-recommends nvidia-driver-460
# Install curl
RUN apt-get update \
&& apt-get install -y curl
# Install git
RUN apt-get -y update \
&& apt-get install -y git
# Install ffmpeg
RUN apt-get -y update \
&& apt-get install -y ffmpeg
# Install yt-dlp
RUN apt-get -y update \
&& apt-get install -y yt-dlp
# Install Python Dependencies
RUN apt-get -y update \
&& apt-get install -y software-properties-common
# Adding PPA for Python 3.10
RUN apt-get -y update \
&& add-apt-repository ppa:deadsnakes/ppa
# Install Python 3.10
RUN apt-get -y update \
&& apt-get install -y python3.10 python3.10-distutils
# Setting Python 3.10 as the default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
RUN update-alternatives --config python3
# Download and install pip for Python 3.10
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.10 get-pip.py
# Check Python and pip versions
RUN python3.10 --version \
&& pip --version
# Install Cryptodome
RUN apt-get -y update \
&& apt-get install -y python-pycryptodome
RUN apt-get install --reinstall systemd
# RabbitMQ Installaiotn
RUN apt update && apt upgrade -y
RUN apt install curl gnupg -y
# RUN curl -fsSL https://packages.rabbitmq.com/gpg | apt-key add -
RUN apt update && apt install rabbitmq-server -y
RUN systemctl enable rabbitmq-server
# RUN systemctl status rabbitmq-server
# RUN systemctl start rabbitmq-server
# RUN chkconfig rabbitmq-server on
RUN service rabbitmq-server start
# # FROM python:3.10
# Switch back to the root user to install Python packages
USER root
# Copy your requirements.txt and install Python packages
COPY ./requirements.txt /code/requirements.txt
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
# Create a non-root user and set environment variables
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory and copy your application files
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# Specify the command to run your application
CMD ["celery", "-A", "main.celery", "worker", "--loglevel=info"]
# CMD ["celery", "-A", "main.celery", "flower"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]