File size: 1,097 Bytes
873a4cd
 
 
 
562d9e9
 
 
 
 
 
873a4cd
 
 
562d9e9
 
873a4cd
562d9e9
 
 
 
 
 
 
873a4cd
 
b8facd5
873a4cd
 
 
 
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
FROM python:3.9-slim

WORKDIR /app

# Create directories that the application might need to write to or expect to exist.
# These are created by root during the build.
RUN mkdir -p /app/templates \
             /app/static \
             /app/uploaded_files

# Copy application code
COPY ./app.py /app/
COPY ./templates/ /app/templates/
# If you had local static files, you'd copy them here:
# COPY ./static/ /app/static/

# Grant write permissions to the 'uploaded_files' directory for the user running the app.
# Hugging Face Spaces (and many other container platforms) often run containers
# as a non-root user (e.g., UID 1000).
# We give ownership to user 1000 and group 1000.
# You could also use `chmod -R 777 /app/uploaded_files` but chown is more specific.
RUN chown -R 1000:1000 /app/uploaded_files \
    && chmod -R u+w /app/uploaded_files # Ensure the owner (user 1000) has write permissions

# Install dependencies
RUN pip install --no-cache-dir fastapi "uvicorn[standard]" aiofiles Jinja2 python-multipart

EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]