File size: 1,240 Bytes
a09c762
 
 
 
 
 
 
 
 
 
 
 
 
 
00a0c35
 
 
 
 
 
50bc06e
00a0c35
 
 
 
 
 
50bc06e
00a0c35
 
a09c762
 
 
 
 
f7dd02f
a09c762
 
 
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
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

FROM python:3.11-buster

# Install Poetry package manager
RUN pip install poetry==1.5.1

# Set Poetry environment variables for non-interactive mode, virtual environments in project, auto creation, and cache directory
ENV POETRY_NO_INTERACTION=1 \
    POETRY_VIRTUALENVS_IN_PROJECT=1 \
    POETRY_VIRTUALENVS_CREATE=1 \
    POETRY_CACHE_DIR=/tmp/poetry_cache

# Create a user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory inside the container
WORKDIR $HOME/app

COPY --chown=user pyproject.toml poetry.lock ./
COPY --chown=user chainlit.md app.py prompts.py ./
COPY --chown=user .chainlit ./
COPY --chown=user .chainlit/config.toml .chainlit/config.toml

# Change the permissions of the working directory "read and write for user, read for others"
RUN chmod -R 755 $HOME/app

# Install project dependencies using Poetry
RUN poetry install --without dev

# Define the default command to run the application
CMD ["poetry", "run", "chainlit", "run", "app.py", "--port", "7860"]

# Expose port 7860 for external access
EXPOSE 7860