File size: 1,210 Bytes
d5c46e9
 
7202336
 
 
e8de95e
 
 
7202336
e8de95e
 
c633b82
 
 
7202336
d5c46e9
 
7202336
 
d5c46e9
c633b82
7202336
d5c46e9
7202336
 
d5c46e9
7202336
d5c46e9
 
 
 
7202336
d5c46e9
08e5dcd
 
d5c46e9
7202336
d5c46e9
 
c633b82
 
 
 
7202336
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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"

# Create a symlink so Poetry is accessible system-wide
RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry

# Set working directory
WORKDIR /code

# Copy Poetry files first to optimize Docker caching
COPY pyproject.toml poetry.lock /code/

# Install dependencies using Poetry
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

# Expose the application port
EXPOSE 8000

# Ensure logs are not buffered
ENV PYTHONUNBUFFERED=1

# Run the application using Poetry's virtual environment
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]