I have this in Dockerfile:
Use the official Python image from the Docker Hub with Python 3.9.12
FROM python:3.9.12
Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Set the working directory inside the container
WORKDIR /app
Copy the entire directory into the container
COPY . /app
Install required system packages
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
Install required Python packages
RUN pip install --no-cache-dir flask tensorflow jsonify
RUN pip install --no-cache-dir gunicorn
Expose port 5000 to the outside world
EXPOSE 5000
Command to run the Gunicorn server with 4 worker processes
CMD [“gunicorn”, “–workers”, “2”, “–timeout”, “180”, “–bind”, “0.0.0.0:5000”, “app:app”]
I am getting permission error when my app.py runs, telling:
…
os.makedirs(temp_folder, exist_ok=True)
File “/usr/local/lib/python3.9/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘temporary’
[2024-04-19 06:57:15 +0000] [8] [INFO] Worker exiting (pid: 8)
[2024-04-19 06:57:15 +0000] [1] [ERROR] Worker (pid:7) exited with code 3
[2024-04-19 06:57:15 +0000] [1] [ERROR] Worker (pid:8) was sent SIGTERM!
[2024-04-19 06:57:15 +0000] [1] [ERROR] Shutting down: Master
[2024-04-19 06:57:15 +0000] [1] [ERROR] Reason: Worker failed to boot.