-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (38 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (38 loc) · 1.1 KB
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
# Use slim Python base image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
# Install system-level dependencies for numpy, scipy, etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
build-essential \
libffi-dev \
libpq-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
libjpeg-dev \
zlib1g-dev \
libblas-dev \
liblapack-dev \
gfortran \
wget \
redis-server \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Download NLTK corpora
RUN python -m nltk.downloader punkt stopwords
# Expose FastAPI app port
EXPOSE 5000
# Starting redis first in background, then the backend app
CMD redis-server --daemonize yes && gunicorn app.main:app -k uvicorn.workers.UvicornWorker -w 4 -b 0.0.0.0:5000 --timeout 1000