justin4602/Sample_set_assignment
0
1# Use the official Python 3.9 image as the base image
2FROM python:3.9
3
4# Set the working directory inside the container
5WORKDIR /app
6
7# Copy the requirements file to the working directory
8COPY requirements.txt /app/requirements.txt
9
10# Install the required dependencies
11RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
12
13# Set environment variables for Streamlit and other configurations
14ENV PYTHONUNBUFFERED=1 \
15 PATH="/home/user/.local/bin:$PATH" \
16 HOME=/home/user
17
18# Set up a new user named "user"
19RUN useradd user
20
21# Switch to the "user" user
22USER user
23
24# Set the working directory to the user's home directory
25WORKDIR /home/user/app
26
27# Copy the app content to the container and change ownership to the user
28COPY --chown=user . /home/user/app
29
30# Expose the port Streamlit will use
31EXPOSE 8501
32
33# Run the Streamlit app
34CMD ["streamlit", "run", "Groq_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
35 