Spaces:
Sleeping
Sleeping
File size: 861 Bytes
c682766 3f08411 d3d1dfd 3f08411 c682766 3f08411 c682766 3f08411 c682766 3f08411 8b59c22 3f08411 c682766 4c3a52d |
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 |
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV ALLOWED_HOSTS=nitinbot001-mistrybox.hf.space,localhost,127.0.0.1
# Create a non-root user
RUN useradd -m -u 1000 appuser && \
mkdir -p /app && \
chown -R appuser:appuser /app
# Set the working directory in the container
WORKDIR /app
# Copy requirements first (for better caching)
COPY --chown=appuser:appuser requirements.txt /app/
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire project
COPY --chown=appuser:appuser . /app/
# Switch to non-root user
USER appuser
# Expose port 7860
EXPOSE 7860
# Run the application
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:7860"] |