Spaces:
Runtime error
Runtime error
File size: 1,106 Bytes
d030f4c f384f5a d030f4c 76afedf f384f5a d030f4c f384f5a d030f4c f384f5a d030f4c f384f5a d030f4c f384f5a d030f4c f384f5a d030f4c f384f5a d030f4c 44df8cb d030f4c 44df8cb d030f4c f384f5a d030f4c f384f5a d030f4c |
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 |
# Dockerfile for Python application with dependencies and runtime optimizations
# Use Python 3.10 slim-buster as base image
FROM python:3.10-slim-buster
# Set working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ffmpeg \
libsm6 \
libxext6 \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Copy everything from the current directory to /app in the container
COPY . .
# Install Python dependencies
RUN pip install --no-cache-dir -r api/requirements.txt
# Create a non-root user to run the application
RUN useradd -m -u 1000 user
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app/scripts
# Set ownership to non-root user
RUN chown -R user:user /app
# Switch to the non-root user
USER user
# Install the application in editable mode
RUN pip install --no-cache-dir -e /app
# Set working directory for the application
WORKDIR /app/api
# Command to run the application
CMD ["python", "endpoints.py"]
|