Spaces:
Sleeping
Sleeping
Commit ·
873a169
1
Parent(s): eec757a
update
Browse files- Dockerfile +11 -0
Dockerfile
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
# Use the official Python image
|
| 2 |
FROM python:3.9
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
|
@@ -8,6 +16,9 @@ WORKDIR /app
|
|
| 8 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 9 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
# Copy the rest of the application files
|
| 12 |
COPY --chown=user . /app
|
| 13 |
|
|
|
|
| 1 |
# Use the official Python image
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Add a non-root user and set up the environment
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
+
|
| 9 |
+
# Set environment variables for Hugging Face
|
| 10 |
+
ENV TRANSFORMERS_CACHE=/app/cache
|
| 11 |
+
|
| 12 |
# Set working directory
|
| 13 |
WORKDIR /app
|
| 14 |
|
|
|
|
| 16 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 18 |
|
| 19 |
+
# Create cache directory for Hugging Face and ensure permissions
|
| 20 |
+
RUN mkdir -p /app/cache && chown user:user /app/cache
|
| 21 |
+
|
| 22 |
# Copy the rest of the application files
|
| 23 |
COPY --chown=user . /app
|
| 24 |
|