Spaces:
Running
Running
lucabadiali
commited on
Commit
·
cbd0ecc
1
Parent(s):
15122b5
AA
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Base Python image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# 2. Create a non-root user (HF likes this pattern)
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
|
| 8 |
+
# 3. Set working directory
|
| 9 |
+
ENV HOME=/home/user
|
| 10 |
+
WORKDIR /home/user/app
|
| 11 |
+
|
| 12 |
+
# 4. Copy dependency file and install deps
|
| 13 |
+
COPY --chown=user requirements.txt .
|
| 14 |
+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# 5. Copy the rest of the code
|
| 17 |
+
COPY --chown=user . .
|
| 18 |
+
|
| 19 |
+
# 6. Expose the port your app will listen on
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
# 7. Start the app
|
| 23 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|