-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (28 loc) · 1.23 KB
/
Dockerfile
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
# ./Dockerfile
# Use the official Python image as the base image
FROM python:3.12-slim
# Set environment variables for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Set the working directory inside the container
WORKDIR /app
# Install system-level dependencies (if necessary)
# These are common dependencies needed by packages like cryptography, pandas, etc.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc libssl-dev libffi-dev \
libxml2-dev libxslt1-dev zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements.txt first to leverage Docker cache
COPY requirements.txt .
# Install the Python dependencies
RUN pip install --upgrade pip
# Install the Python dependencies from requirements.txt
RUN pip install -r requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Expose the port Streamlit will run on (optional)
EXPOSE 8880
# Command to run the Streamlit app using a shell to handle environment variable substitution
# We default to port 8880 if the PORT env var isn't defined
CMD ["sh", "-c", "streamlit run /app.py --server.port=${PORT:-8880} --server.enableCORS=false"]