SimpleChatbot / Dockerfile
NandyG's picture
created user in dockerfile
00a0c35
Raw
History Blame Contribute Delete
1.24 kB
# 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