spacesedan commited on
Commit
ad07efe
·
1 Parent(s): 9e815e0
Files changed (1) hide show
  1. Dockerfile +7 -0
Dockerfile CHANGED
@@ -1,14 +1,21 @@
1
  FROM python:3.9
2
 
 
3
  RUN useradd -m -u 1000 user
4
  USER user
5
  ENV PATH="/home/user/.local/bin:$PATH"
6
 
7
  WORKDIR /app
8
 
 
9
  COPY --chown=user ./requirements.txt requirements.txt
10
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
 
 
 
 
12
  COPY --chown=user . /app
13
 
 
14
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9
2
 
3
+ # Create non-root user
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
  WORKDIR /app
9
 
10
+ # Copy and install Python requirements
11
  COPY --chown=user ./requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Download NLTK 'punkt' tokenizer during build
15
+ RUN python -c "import nltk; nltk.download('punkt')"
16
+
17
+ # Copy the app source code
18
  COPY --chown=user . /app
19
 
20
+ # Run the FastAPI app with Uvicorn
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]