Spaces:
Sleeping
Sleeping
| FROM python:3.10 | |
| # Create a new user "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Set environment variables for the user's home and PATH | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Copy the application code and set the owner to "user" | |
| COPY --chown=user . $HOME/app | |
| # Switch to root to install dependencies and adjust permissions | |
| USER root | |
| # Install Python dependencies | |
| RUN pip3 install -r requirements.txt | |
| # Create the exports/charts directory (if not already present) and update its permissions | |
| RUN mkdir -p $HOME/app/exports/charts && chmod -R 777 $HOME/app/exports/charts | |
| # (Optional) Update permissions for the entire app directory if needed | |
| RUN chmod -R 777 $HOME/app | |
| # Switch back to the "user" | |
| USER user | |
| # Command to run the app | |
| CMD ["python", "main.py"] | |