FROM python:3.10.12 # always create the user first and add # to avoid the permission issue when editing the files later especially # if you want to use the dev mode RUN useradd -m -u 1000 user # define the directory and install packages WORKDIR /app COPY ./packages.txt /app/packages.txt RUN apt-get update && xargs -r -a packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/* # copy the requirements to container and install them COPY --chown=user ./requirements.txt requirements.txt RUN pip3 install --no-cache-dir -r requirements.txt # Copy the current directory contents into the container at /app setting the owner to the user # also set the user as owner for root directory to enable update permissions COPY --link --chown=1000 ./ /app # app will need to expose the port for taking browser inputs # make sure to have same port as mentioned in Readme.md # rest of the code is from https://huggingface.co/spaces/SpacesExamples/streamlit-docker-example/blob/main/Dockerfile # sepcific for streamlit docker EXPOSE 8501 CMD streamlit run app.py \ --server.headless true \ --server.enableCORS false \ --server.enableXsrfProtection false \ --server.fileWatcherType none