File size: 1,906 Bytes
ced87b5 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
### use the officila python 3.10 image
FROM python:3.10
# set the working directory to /code
WORKDIR /code
# copy the current working directory contents in the container at /code
COPY ./requirements.txt /code/requirements.txt
# install the requirements
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# set up a new user named "user"
RUN useradd -m user
# Switch to the "user" user
USER user
# set the home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
#set the working directory to the user's home directory
WORKDIR $HOME/main
# copy the current directory contents into the container at $Home/app setting the owner
COPY --chown==user:user . $HOME/main
## start the stramlit app
CMD ["streamlit", "run", "main.py", "--server.address=0.0.0.0", "--server.port=7860"]
# FROM python:3.10
# # Set the working directory
# WORKDIR /code
# # Add requirements file to the Docker image
# COPY ./requirements.txt /code/requirements.txt
# # Install Python libraries
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# # Add the app folder into the Docker image
# COPY ./app/ /code/app/
# # COPY ./app/.streamlit /code/app/.streamlit
# WORKDIR /code/app
# # Set environment variable for Flask
# # ENV FLASK_APP=app/main.py
# # ENV FLASK_RUN_PORT=80
# # Specify default command to run the Flask app
# # CMD ["flask", "run", "--host=0.0.0.0", "--port=80"]
# # Set the environment variable for Streamlit to find the config file
# # ENV STREAMLIT_CONFIG=/code/app/.streamlit/config.toml
# ENV STREAMLIT_APP=app/main.py
# # Run the Streamlit app
# CMD ["streamlit", "run", "main.py", "--server.port=80", "--server.address=0.0.0.0"]
# # CMD ["gunicorn", "--bind", "0.0.0.0:80", "app.main:app"] |