Spaces:
Running
on
T4
Running
on
T4
Create Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ---------- Base Image ----------
|
2 |
+
FROM python:3.11.11
|
3 |
+
|
4 |
+
# ---------- Environment Variables ----------
|
5 |
+
ENV PYTHONUNBUFFERED=1 \
|
6 |
+
OMP_NUM_THREADS=1 \
|
7 |
+
TOKENIZERS_PARALLELISM=false
|
8 |
+
|
9 |
+
# ---------- Create Non-Root User ----------
|
10 |
+
# Ensures proper file permissions for dev and runtime
|
11 |
+
RUN useradd -m -u 1000 user
|
12 |
+
# ---------- Set Working Directory ----------
|
13 |
+
WORKDIR /app
|
14 |
+
|
15 |
+
# ---------- Install Python Dependencies ----------
|
16 |
+
# Copy requirements and install as non-root user
|
17 |
+
COPY --chown=user requirements.txt .
|
18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
+
|
20 |
+
# ---------- Copy Project Files ----------
|
21 |
+
# Set appropriate ownership and permissions
|
22 |
+
COPY --link --chown=1000 . .
|
23 |
+
|
24 |
+
# ---------- Expose Application Port ----------
|
25 |
+
EXPOSE 7860
|
26 |
+
|
27 |
+
# ---------- Default Command ----------
|
28 |
+
# Launch app via module path
|
29 |
+
CMD ["python", "app.py"]
|