Spaces:
Paused
Paused
File size: 1,391 Bytes
da5c404 0c14636 da5c404 0c14636 da5c404 0c14636 da5c404 e43204a da5c404 e43204a 0c14636 da5c404 78cd21a da5c404 0c14636 517266d da5c404 0c14636 da5c404 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# Use NVIDIA CUDA base image with Python and Ubuntu
FROM nvidia/cuda:12.6.0-devel-ubuntu22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE=/app/cache
# Install Python, pip, and other dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
git \
git-lfs \
curl \
&& git lfs install \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& . "$HOME/.cargo/env" \
&& rm -rf /var/lib/apt/lists/*
# Ensure the `python` command points to `python3`
RUN ln -s /usr/bin/python3 /usr/bin/python
# Install Python packages from requirements.txt
COPY requirements.txt /tmp/
RUN . "$HOME/.cargo/env" && pip install --no-cache-dir -r /tmp/requirements.txt
# Add the /app directory as a safe Git directory
RUN git config --global --add safe.directory /app
# Create a non-root user for better security
RUN useradd -m appuser
# Set up a writable working directory
WORKDIR /app
# Create the cache directory
RUN mkdir -p /app/cache
# Copy project files into the container
COPY --chown=appuser:appuser . /app
# Ensure the /app directory and its subdirectories are writable by appuser
RUN chown -R appuser:appuser /app
# Switch to the non-root user for running the application
USER appuser
# Define the command to run the app
CMD ["python", "train.py"] |