NavyDevilDoc commited on
Commit
845e0fe
·
verified ·
1 Parent(s): 84fcdeb

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Create a non-root user (Security best practice & required by some HF environments)
8
+ RUN useradd -m -u 1000 user
9
+ USER user
10
+ ENV PATH="/home/user/.local/bin:$PATH"
11
+
12
+ # Copy requirements first to leverage Docker cache
13
+ COPY --chown=user requirements.txt requirements.txt
14
+
15
+ # Install dependencies
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application files
20
+ COPY --chown=user app.py app.py
21
+ COPY --chown=user navy_acronyms_clean.json navy_acronyms_clean.json
22
+
23
+ # Expose the port Hugging Face expects
24
+ EXPOSE 7860
25
+
26
+ # Run Streamlit on Port 7860
27
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]