Spaces:
Sleeping
Sleeping
File size: 847 Bytes
69e9d44 9113452 69e9d44 9113452 69e9d44 9113452 bd3b903 9113452 69e9d44 9113452 | 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 | FROM python:3.11.5
# Expose the application port
EXPOSE 7860
# Environment settings
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory inside the container
WORKDIR /app
# Copy the backend code into the container
COPY backend /app
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user
RUN useradd -m -u 1000 user
# Create a writable directory for attachments and assign ownership to the non-root user
USER root
RUN mkdir -p /data/attachments && chown -R user:user /data/attachments
# Ensure correct permissions (optional but recommended)
RUN chown -R root:root /app
# Switch to the non-root user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Start the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |