Travis / Dockerfile
vinay0123's picture
Create Dockerfile
9b14505 verified
Raw
History Blame Contribute Delete
827 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create app user and necessary directories with proper permissions
RUN useradd -m -u 1000 appuser && \
mkdir -p /tmp/app_data && \
chmod -R 777 /tmp/app_data && \
chown -R appuser:appuser /app /tmp/app_data
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set proper ownership for app directory
RUN chown -R appuser:appuser /app
# Expose port
EXPOSE 7860
# Switch to non-root user
USER appuser
# Run the application using Python
CMD ["python", "app.py"]