rairo's picture
Create Dockerfile
d269195 verified
raw
history blame contribute delete
937 Bytes
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 (assuming your requirements.txt now includes streamlit and removes flask)
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 Streamlit app
CMD ["streamlit", "run", "app.py"]