chat / Dockerfile
ariansyahdedy's picture
Fix Dockerfile for Poetry
7202336
raw
history blame
1.1 kB
FROM python:3.10
# Install system dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Set Poetry path (ensures it's available in future RUN commands)
ENV PATH="/root/.local/bin:$PATH"
# Set working directory
WORKDIR /code
# Copy Poetry files first to optimize Docker caching
COPY pyproject.toml poetry.lock /code/
# Install dependencies (without installing the root package)
RUN poetry install --no-root --no-interaction --no-ansi
# Copy the rest of the project files
COPY . /code
# Ensure start script is executable
RUN chmod +x /code/start.sh
# Create necessary directories and set permissions before switching to non-root user
RUN mkdir -p /code/uploaded_videos /code/output_frames \
&& chown -R 1000:1000 /code
# Switch to non-root user
USER 1000
# Set Poetry environment for user
ENV PATH="/home/user/.local/bin:$PATH"
# Expose the application port
EXPOSE 8000
# Run the application
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]