aerospace_chatbot_ams / Dockerfile
dsmueller's picture
Final updates to get working, tested locally
9c24033
raw
history blame
No virus
1.75 kB
# Use an official Python runtime as a parent image
FROM python:3.11.5-bookworm
# Create the directory (if it doesn't already exist)
RUN mkdir -p /usr/src/app
# Change permissions for /usr/src/app to read/write/execute
RUN chmod 777 /usr/src/app
# Set the working directory in the container
WORKDIR /usr/src/app
# Install poetry
RUN pip3 install poetry
# Copy only the necessary files for installing dependencies
COPY pyproject.toml poetry.lock ./
# Disable virtual environments creation by Poetry
# as the Docker container itself is an isolated environment
RUN poetry config virtualenvs.create false
# Install dependencies
# RUN pip3 install -r requirements.txt
RUN poetry install
# Copy the current directory contents into the container at /usr/src/app
COPY . .
# Make a port available to the world outside this container
# The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. Your container needs to listen to Streamlit’s (default) port 8501.
EXPOSE 8501
# The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working. Your container needs to listen to Streamlit’s (default) port 8501:
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Update working directory to be consistent with where Start.py is
WORKDIR /usr/src/app/scripts
# An ENTRYPOINT allows you to configure a container that will run as an executable. Here, it also contains the entire streamlit run command for your app, so you don’t have to call it from the command line
ENTRYPOINT ["streamlit", "run", "Start.py", "--server.port=8501", "--server.address=0.0.0.0"]
# Execute with:
# docker build -t <image_name> .
# docker run -p 8501:8501 <image_name>