File size: 1,079 Bytes
d5c46e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10

RUN useradd -m -u 1000 user

WORKDIR /code

# Install libgl1-mesa-glx and libglib2.0-0
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0

COPY ./requirements.txt /code/requirements.txt

RUN python -m venv /code/venv

RUN /code/venv/bin/pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY --chown=user . /code

# Copy the start script into the container and change permissions before switching to non-root user
COPY start.sh /code/start.sh
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 user:user /code \
    && ls -l /code

USER user

RUN ls -l /code 
RUN ls -l /code/output_frames

ENV PATH="/code/venv/bin:$PATH"

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Define environment variable
ENV PYTHONUNBUFFERED=1

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
# Use the start script as the entry point
# CMD ["/code/start.sh"]