mgbam commited on
Commit
e64829c
·
verified ·
1 Parent(s): 7d3f80a

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -19
Dockerfile CHANGED
@@ -1,31 +1,31 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Copy the requirements file into the container at /app
 
 
 
 
 
 
 
 
 
8
  COPY requirements.txt .
9
 
10
- # Install any needed packages specified in requirements.txt
11
- # Use --no-cache-dir to reduce layer size and --compile to precompile .py to .pyc
12
- RUN pip install --no-cache-dir --compile -r requirements.txt
13
 
14
- # Copy the rest of the application code into the container at /app
15
  COPY . .
16
 
17
- # Make port 8501 available to the world outside this container (Streamlit default)
18
  EXPOSE 8501
19
 
20
- # Define environment variable for Streamlit
21
- ENV STREAMLIT_SERVER_PORT 8501
22
- ENV STREAMLIT_SERVER_HEADLESS true
23
- ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS false
24
-
25
- # Healthcheck (optional but good for orchestration)
26
- # HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
27
-
28
- # Run app.py when the container launches
29
- # Use `streamlit run app.py` which is the standard way to run Streamlit apps
30
- # Add --server.address=0.0.0.0 to make it accessible from outside the container
31
- CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
 
1
+ # Start from a Python base image (choose a version matching your needs)
2
  FROM python:3.10-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Install OS-level dependencies needed for bcrypt and potentially other packages
8
+ # This is for Debian-based images like python:3.10-slim
9
+ RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ libffi-dev \
12
+ python3-dev \
13
+ # Add any other OS packages your app might need
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Copy the requirements file into the container
17
  COPY requirements.txt .
18
 
19
+ # Install Python dependencies
20
+ # Using --no-cache-dir can help ensure fresh installs
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy the rest of your application code into the container
24
  COPY . .
25
 
26
+ # Expose the port Streamlit runs on (default is 8501)
27
  EXPOSE 8501
28
 
29
+ # Command to run your Streamlit application
30
+ # Ensure app.py is your main Streamlit script
31
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]