File size: 827 Bytes
25cf486
c86423c
25cf486
 
c86423c
25cf486
c86423c
25cf486
304f473
25cf486
 
c4feae9
25cf486
 
 
 
 
 
 
 
c86423c
 
25cf486
 
 
 
c86423c
 
 
 
eef30c9
 
 
 
 
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
FROM python:3.9

# Set up working directory and install dependencies
WORKDIR /code

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

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

# Create a new user and set permissions
RUN useradd -m -u 1000 user

USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    HF_HOME=/home/user/.cache/huggingface \
    OPENAI_API_KEY=your_openai_api_key_here

WORKDIR $HOME/app

# Copy the rest of the application code into the container
COPY --chown=user . $HOME/app

# Ensure the cache directory has proper permissions
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME

# Expose the port the app runs on
EXPOSE 8000

# Install hypercorn
RUN pip install hypercorn

# Run the application using hypercorn
CMD ["hypercorn", "main:app", "--bind", "0.0.0.0:8000"]