File size: 963 Bytes
c2a6c7b
 
744ad58
 
b095273
831fef5
 
 
14a2528
31bc1fb
c2a6c7b
744ad58
 
 
1d1607e
744ad58
92ec33b
20f4bc7
e3f2ea2
 
 
8fe417c
d3f4eca
831fef5
772d8cb
56ac794
c2a6c7b
744ad58
c2a6c7b
831fef5
14cdbfb
3c8a392
14cdbfb
 
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
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

# 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"

# Use PORT environment variable provided by Railway
# CMD ["uvicorn", "app.main:app", "--host", "${HOST}", "--port", "${PORT}"]
# CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT}"]
# Use a shell to expand environment variables
CMD ["sh", "-c", "uvicorn app.main:app --host $HOST --port $PORT"]