Refactor comments in Dockerfile for clarity and consistency
Browse files- Dockerfile +7 -9
Dockerfile
CHANGED
|
@@ -1,29 +1,27 @@
|
|
| 1 |
-
# Use Python 3.11 to satisfy the 'perception-models' requirement
|
| 2 |
FROM python:3.11
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
# Install system dependencies (ffmpeg is required for audio
|
| 8 |
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
# Copy requirements and install Python dependencies
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir --upgrade pip
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
-
# Set up a
|
| 16 |
-
# (This is a Hugging Face Spaces security requirement)
|
| 17 |
RUN useradd -m -u 1000 user
|
| 18 |
USER user
|
| 19 |
ENV HOME=/home/user \
|
| 20 |
PATH=/home/user/.local/bin:$PATH
|
| 21 |
|
| 22 |
-
# Set working directory to the user's home directory
|
| 23 |
WORKDIR $HOME/app
|
| 24 |
|
| 25 |
-
# Copy
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
| 28 |
-
#
|
| 29 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# 1. Use Python 3.11 to satisfy the 'perception-models' requirement
|
| 2 |
FROM python:3.11
|
| 3 |
|
| 4 |
+
# 2. Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# 3. Install system dependencies (ffmpeg is required for audio)
|
| 8 |
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# 4. Copy requirements and install Python dependencies
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir --upgrade pip
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
+
# 5. Set up a user (Required by HF Spaces security)
|
|
|
|
| 16 |
RUN useradd -m -u 1000 user
|
| 17 |
USER user
|
| 18 |
ENV HOME=/home/user \
|
| 19 |
PATH=/home/user/.local/bin:$PATH
|
| 20 |
|
|
|
|
| 21 |
WORKDIR $HOME/app
|
| 22 |
|
| 23 |
+
# 6. Copy application files
|
| 24 |
COPY --chown=user . $HOME/app
|
| 25 |
|
| 26 |
+
# 7. Start the app
|
| 27 |
CMD ["python", "app.py"]
|