FROM python:3.10 | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
ENV POETRY_CACHE_DIR=/home/user/.cache/pypoetry | |
# Set the working directory to a writable location | |
WORKDIR /home/user/app | |
# Install Poetry | |
RUN pip install --no-cache-dir --upgrade pip \ | |
&& pip install --no-cache-dir poetry | |
# Copy the pyproject.toml file | |
COPY --chown=user ./pyproject.toml ./poetry.lock* ./ | |
# Install dependencies with Poetry | |
RUN poetry install --only main --no-interaction --no-ansi | |
# Copy the rest of the application code | |
COPY --chown=user . /home/user/app | |
# Expose the Streamlit default port | |
EXPOSE 8501 | |
# Run the Streamlit app | |
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |