ImageDataExtractor2 / Dockerfile
WebashalarForML's picture
Update Dockerfile
eed6dfe verified
raw
history blame
1.1 kB
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set the working directory inside the container
WORKDIR /app
# Copy the requirements file into the container at /app
COPY requirements.txt /app/
# Install the dependencies specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Create the necessary directories and ensure they have proper permissions
RUN mkdir -p /app/uploads /app/static/uploads /app/static/results /tmp/flask_sessions /app/flask_sessions && \
chmod -R 777 /app/uploads /app/static/uploads /app/static/results /tmp/flask_sessions /app/flask_sessions
# Copy the entire application code to /app
COPY . /app/
# Expose the port used by the Flask app
EXPOSE 7860
# Set environment variables for Flask
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV SESSION_FILE_DIR=/app/flask_sessions
# Run the application with Gunicorn, setting workers and timeout
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]