FROM python:3.10 | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set the working directory | |
WORKDIR /app | |
# Copy Poetry config and install Poetry | |
COPY --chown=user ./pyproject.toml ./poetry.lock* ./ | |
RUN pip install --no-cache-dir --upgrade pip \ | |
&& pip install --no-cache-dir poetry \ | |
&& poetry config virtualenvs.create false \ | |
&& poetry install --no-dev --no-interaction --no-ansi | |
# Copy the rest of the app | |
COPY --chown=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"] | |