| FROM python:3.9 | |
| # Create a user with a specified UID to avoid permission issues | |
| RUN useradd -m -u 1000 user | |
| # Set the working directory to the user's home directory | |
| WORKDIR /app | |
| # Install system dependencies (sudo, npm) as root | |
| # Copy package.json and package-lock.json to the working directory and set the owner to user | |
| # Set the user for subsequent commands | |
| COPY --chown=user ./main.py main.py | |
| COPY --chown=user ./r.txt r.txt | |
| # Install Node.js dependencies | |
| RUN pip3 install -r r.txt | |
| # Copy the rest of the application code to the working directory and set the owner to user | |
| COPY --chown=user . /app | |
| # Ensure the user has write permission to health_data.json | |
| # Expose the port your app runs on | |
| EXPOSE 7860 | |
| # Command to run your application | |
| CMD gunicorn -w 4 -b 0.0.0.0:7860 main:app | |