Spaces:
Runtime error
Runtime error
Commit
·
3b8d04f
1
Parent(s):
089c702
fix: refine Dockerfile for user permissions and dependency installation
Browse files- Dockerfile +23 -25
Dockerfile
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
#
|
| 2 |
FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
|
| 3 |
|
| 4 |
# Labels
|
| 5 |
-
|
| 6 |
LABEL maintainer="Jacob Schmieder"
|
| 7 |
LABEL email="Jacob.Schmieder@dbfz.de"
|
| 8 |
LABEL version="0.1.1.dev"
|
|
@@ -12,12 +11,6 @@ LABEL description="Scraibe is a tool for automatic speech recognition and speake
|
|
| 12 |
speech recognition and speaker diarization."
|
| 13 |
LABEL url="https://github.com/JSchmie/ScrAIbe"
|
| 14 |
|
| 15 |
-
RUN apt update -y && sudo apt upgrade -y && \
|
| 16 |
-
apt install -y libsm6 libxrender1 libfontconfig1 && \
|
| 17 |
-
apt clean && \
|
| 18 |
-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
| 19 |
-
|
| 20 |
-
# Set up a new user named "hyathi" with user ID 1001
|
| 21 |
# Set up a new user named "hyathi" with user ID 1000
|
| 22 |
RUN useradd -m -u 1000 hyathi
|
| 23 |
|
|
@@ -25,7 +18,7 @@ RUN useradd -m -u 1000 hyathi
|
|
| 25 |
RUN apt update -y && apt install -y sudo
|
| 26 |
|
| 27 |
# Allow the user to run apt commands without a password prompt by modifying sudoers file
|
| 28 |
-
|
| 29 |
|
| 30 |
# Switch to the new user
|
| 31 |
USER hyathi
|
|
@@ -34,39 +27,44 @@ USER hyathi
|
|
| 34 |
ENV HOME=/home/hyathi \
|
| 35 |
PATH=/home/hyathi/.local/bin:$PATH
|
| 36 |
|
| 37 |
-
# Install
|
|
|
|
|
|
|
|
|
|
| 38 |
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
# Install dependencies
|
| 42 |
WORKDIR $HOME/app
|
| 43 |
|
| 44 |
-
|
| 45 |
-
#Enviorment dependencies
|
| 46 |
ENV TRANSFORMERS_CACHE=/app/models
|
| 47 |
ENV HF_HOME=/app/models
|
| 48 |
ENV AUTOT_CACHE=/app/models
|
| 49 |
ENV PYANNOTE_CACHE=/app/models/pyannote
|
| 50 |
-
|
|
|
|
| 51 |
COPY requirements.txt /app/requirements.txt
|
| 52 |
COPY README.md /app/README.md
|
| 53 |
COPY scraibe /app/scraibe
|
| 54 |
|
| 55 |
-
#Installing all necessary dependencies and running the application with a
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
|
|
|
| 61 |
RUN conda update --all && \
|
| 62 |
-
# conda install -y pip ffmpeg && \
|
| 63 |
conda install -c conda-forge libsndfile && \
|
| 64 |
conda clean --all -y
|
| 65 |
-
|
|
|
|
| 66 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 67 |
|
| 68 |
-
# Expose port
|
| 69 |
EXPOSE 7860
|
| 70 |
-
# Run the application
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
| 1 |
+
# Use the official PyTorch image as the base
|
| 2 |
FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
|
| 3 |
|
| 4 |
# Labels
|
|
|
|
| 5 |
LABEL maintainer="Jacob Schmieder"
|
| 6 |
LABEL email="Jacob.Schmieder@dbfz.de"
|
| 7 |
LABEL version="0.1.1.dev"
|
|
|
|
| 11 |
speech recognition and speaker diarization."
|
| 12 |
LABEL url="https://github.com/JSchmie/ScrAIbe"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Set up a new user named "hyathi" with user ID 1000
|
| 15 |
RUN useradd -m -u 1000 hyathi
|
| 16 |
|
|
|
|
| 18 |
RUN apt update -y && apt install -y sudo
|
| 19 |
|
| 20 |
# Allow the user to run apt commands without a password prompt by modifying sudoers file
|
| 21 |
+
RUN echo "hyathi ALL=(ALL) NOPASSWD: /usr/bin/apt, /bin/rm" >> /etc/sudoers
|
| 22 |
|
| 23 |
# Switch to the new user
|
| 24 |
USER hyathi
|
|
|
|
| 27 |
ENV HOME=/home/hyathi \
|
| 28 |
PATH=/home/hyathi/.local/bin:$PATH
|
| 29 |
|
| 30 |
+
# Install Miniconda (if not already installed) to the user's home directory
|
| 31 |
+
RUN curl -sSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh && \
|
| 32 |
+
bash /tmp/miniconda.sh -b -p /home/hyathi/miniconda && \
|
| 33 |
+
rm /tmp/miniconda.sh
|
| 34 |
|
| 35 |
+
# Add Conda to the PATH
|
| 36 |
+
ENV PATH="/home/hyathi/miniconda/bin:$PATH"
|
| 37 |
|
| 38 |
+
# Set the working directory
|
|
|
|
| 39 |
WORKDIR $HOME/app
|
| 40 |
|
| 41 |
+
# Environment dependencies
|
|
|
|
| 42 |
ENV TRANSFORMERS_CACHE=/app/models
|
| 43 |
ENV HF_HOME=/app/models
|
| 44 |
ENV AUTOT_CACHE=/app/models
|
| 45 |
ENV PYANNOTE_CACHE=/app/models/pyannote
|
| 46 |
+
|
| 47 |
+
# Copy all necessary files
|
| 48 |
COPY requirements.txt /app/requirements.txt
|
| 49 |
COPY README.md /app/README.md
|
| 50 |
COPY scraibe /app/scraibe
|
| 51 |
|
| 52 |
+
# Installing all necessary dependencies and running the application with a personalized Hugging-Face-Token
|
| 53 |
+
RUN sudo apt update -y && sudo apt upgrade -y && \
|
| 54 |
+
sudo apt install -y libsm6 libxrender1 libfontconfig1 && \
|
| 55 |
+
sudo apt clean && \
|
| 56 |
+
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
| 57 |
|
| 58 |
+
# Update Conda and install libsndfile
|
| 59 |
RUN conda update --all && \
|
|
|
|
| 60 |
conda install -c conda-forge libsndfile && \
|
| 61 |
conda clean --all -y
|
| 62 |
+
|
| 63 |
+
# Install Python dependencies from requirements.txt
|
| 64 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 65 |
|
| 66 |
+
# Expose the port for the app
|
| 67 |
EXPOSE 7860
|
|
|
|
| 68 |
|
| 69 |
+
# Run the application
|
| 70 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|