Spaces:
Runtime error
Runtime error
File size: 1,026 Bytes
d9bb199 3cd7dfc d9bb199 3cd7dfc d9bb199 3cd7dfc d9bb199 7519a74 |
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 36 37 38 39 40 41 42 43 44 45 46 47 |
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED 1
# Install system dependencies and git
RUN apt-get update && apt-get install -y \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user and set permissions
RUN useradd -ms /bin/bash appuser
# Set the working directory in the container
WORKDIR /home/appuser/app
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
# Switch to non-root user
USER appuser
# Copy the rest of the application code into the container
COPY --chown=appuser . /home/appuser/app
# Expose the port that the app runs on
# EXPOSE 8501
# (optional) you can keep EXPOSE, but it's not used by Spaces
# EXPOSE 8501
# Use the port Spaces provides
ENV PORT=7860
# Start Streamlit and bind to 0.0.0.0:$PORT
CMD ["sh","-c","streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}"] |