addedDockerfile
Browse files- Dockerfile +47 -0
Dockerfile
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Create a non-root user and set up environment
|
4 |
+
RUN useradd -m -u 1000 appuser
|
5 |
+
ENV HOME=/home/appuser
|
6 |
+
ENV PATH=$HOME/.local/bin:$PATH
|
7 |
+
|
8 |
+
# Switch to the app user's home directory for proper permissions
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Copy app files
|
12 |
+
COPY . /app
|
13 |
+
|
14 |
+
# Adjust ownership for the non-root user
|
15 |
+
RUN chown -R appuser:appuser /app
|
16 |
+
|
17 |
+
# Install system dependencies
|
18 |
+
RUN apt-get update && \
|
19 |
+
apt-get upgrade -y && \
|
20 |
+
apt-get install -y \
|
21 |
+
build-essential \
|
22 |
+
git \
|
23 |
+
cmake \
|
24 |
+
poppler-utils \
|
25 |
+
ffmpeg \
|
26 |
+
libsm6 \
|
27 |
+
libxext6 && \
|
28 |
+
apt-get clean && \
|
29 |
+
rm -rf /var/lib/apt/lists/*
|
30 |
+
|
31 |
+
# Switch to non-root user
|
32 |
+
USER appuser
|
33 |
+
|
34 |
+
# Install Python dependencies
|
35 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
36 |
+
pip install --no-cache-dir -r requirements.txt
|
37 |
+
|
38 |
+
# Set NLTK data directory and download data
|
39 |
+
ENV NLTK_DATA=/app/nltk_data
|
40 |
+
RUN mkdir -p $NLTK_DATA && \
|
41 |
+
python -m nltk.downloader -d $NLTK_DATA all
|
42 |
+
|
43 |
+
# Expose the application port
|
44 |
+
EXPOSE 7860
|
45 |
+
|
46 |
+
# Start the application
|
47 |
+
CMD ["python", "app.py"]
|