deep_learning / Dockerfile
TensorGuy01's picture
Update Dockerfile
aec0d06 verified
Raw History Blame Contribute Delete
810 Bytes
# Use official lightweight Python image
FROM python:3.10-slim
# Set a working directory with write permissions
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc libgl1 libglib2.0-0 && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' appuser
USER appuser
ENV HOME=/home/appuser
ENV PATH="${HOME}/.local/bin:${PATH}"
# Copy the app script (assumes app.py is in the same folder)
COPY --chown=appuser:appuser app.py .
# Install Python packages in user space
RUN python -m pip install --no-cache-dir python-telegram-bot==20.0 requests fastapi uvicorn
# Expose Flask port required by Hugging Face Spaces
EXPOSE 7860
# Run the app as non-root user
CMD ["python", "app.py"]