FROM python:3.9 # Set the working directory WORKDIR /app # Copy necessary files COPY app.py requirements.txt index.html gagalin.otf image.png ./ # Ensure full permissions for necessary directories RUN mkdir -p /app/static/images /app/webdriver_cache \ && chmod -R 777 /app/static/images /app/webdriver_cache \ && chown -R 1000:1000 /app/static/images /app/webdriver_cache # Set WebDriver Manager to use this directory ENV WDM_LOCAL="/app/webdriver_cache" # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Ensure /app is writable RUN chmod -R 777 /app && chown -R 1000:1000 /app # Expose the Flask port EXPOSE 7860 # Run the application as a non-root user USER 1000:1000 # Run the application CMD ["python", "app.py"]