FROM python:3.9-slim | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
ENV TZ=Asia/Shanghai | |
WORKDIR /app | |
# Install git | |
RUN apt-get update && apt-get install -y git | |
# Clone the repository | |
RUN git clone https://github.com/Chenyme/oaifree-tools.git . | |
# Create a non-root user | |
RUN useradd -m myuser | |
# Create log directory and set ownership | |
RUN mkdir -p /app/config && chown -R myuser:myuser /app | |
# Install dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 暴露容器端口 | |
EXPOSE 8501 | |
# Switch to non-root user | |
USER myuser | |
CMD ["streamlit", "run", "/app/home.py"] |