Spaces:
Runtime error
Runtime error
Soumic commited on
Commit ·
ea8ca50
1
Parent(s): 4792fc5
:lady_beetle: Fix cache folder permissions
Browse files- Dockerfile +24 -10
Dockerfile
CHANGED
|
@@ -1,22 +1,36 @@
|
|
| 1 |
# Use the official PyTorch Docker image as a base (includes CUDA and PyTorch)
|
| 2 |
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
# Create a
|
| 8 |
-
RUN
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --upgrade pip
|
| 16 |
RUN pip install -r requirements.txt
|
| 17 |
|
| 18 |
-
# Copy the training script
|
| 19 |
-
COPY app.py .
|
| 20 |
-
|
| 21 |
# Run the training script
|
| 22 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
# Use the official PyTorch Docker image as a base (includes CUDA and PyTorch)
|
| 2 |
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
|
| 3 |
|
| 4 |
+
# Install required dependencies (add any additional system dependencies you need)
|
| 5 |
+
RUN apt update && apt install -y ffmpeg
|
| 6 |
|
| 7 |
+
# Create a non-root user with a home directory
|
| 8 |
+
RUN useradd -m -u 1000 user
|
| 9 |
|
| 10 |
+
# Switch to the new non-root user
|
| 11 |
+
USER user
|
| 12 |
|
| 13 |
+
# Set environment variables for the new user
|
| 14 |
+
ENV HOME=/home/user \
|
| 15 |
+
PATH=/home/user/.local/bin:$PATH
|
| 16 |
+
|
| 17 |
+
# Set a working directory
|
| 18 |
+
WORKDIR $HOME/app
|
| 19 |
+
|
| 20 |
+
# Set the TRANSFORMERS_CACHE directory to be within the user's home directory
|
| 21 |
+
ENV TRANSFORMERS_CACHE=$HOME/cache
|
| 22 |
+
|
| 23 |
+
# Copy the app code and set ownership to the non-root user
|
| 24 |
+
COPY --chown=user . $HOME/app
|
| 25 |
+
|
| 26 |
+
# Install Python dependencies in the virtual environment
|
| 27 |
+
RUN python -m venv /home/user/venv
|
| 28 |
+
ENV PATH="/home/user/venv/bin:$PATH"
|
| 29 |
+
|
| 30 |
+
# Install pip dependencies within the virtual environment
|
| 31 |
COPY requirements.txt .
|
| 32 |
RUN pip install --upgrade pip
|
| 33 |
RUN pip install -r requirements.txt
|
| 34 |
|
|
|
|
|
|
|
|
|
|
| 35 |
# Run the training script
|
| 36 |
CMD ["python", "app.py"]
|