File size: 1,040 Bytes
040e129
575edf7
 
 
 
040e129
a487857
 
575edf7
 
 
9657bb7
 
 
 
 
040e129
9657bb7
040e129
a487857
 
575edf7
 
a487857
7189d2c
 
 
 
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
FROM python:3.9

WORKDIR /code

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

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

COPY . .

# Expose the secret AZURE_OPENAI_API_KEY at buildtime
RUN --mount=type=secret,id=AZURE_OPENAI_API_KEY,mode=0444,required=true \
    export AZURE_OPENAI_API_KEY=$(cat /run/secrets/AZURE_OPENAI_API_KEY)

# Expose the secret AZURE_OPENAI_ENDPOINT at buildtime
RUN --mount=type=secret,id=AZURE_OPENAI_ENDPOINT,mode=0444,required=true \
    export AZURE_OPENAI_ENDPOINT=$(cat /run/secrets/AZURE_OPENAI_ENDPOINT)

# must define the address and port because Hugging Face will expect to serve the application on port 7860
# specify the allow-websocket-origin flag to enable the connection to the server’s websocket
CMD ["panel", "serve", "/code/app.py", "--address", "0.0.0.0", "--port", "7860",  "--allow-websocket-origin", "*"]

# these may not be necessary
#RUN mkdir /.cache
#RUN chmod 777 /.cache
#RUN mkdir .chroma
#RUN chmod 777 .chroma