OcanPredict / Dockerfile
piyush3's picture
Update Dockerfile
ae09a0d verified
FROM python:3.9
# Install system dependencies for OpenCV
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create and switch to non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy and install requirements
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Set Flask environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=7860
# Expose port
EXPOSE 7860
# Run Flask application with host and port specified
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]