Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +27 -27
Dockerfile
CHANGED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
-
# Gunakan image Python yang ringan
|
| 2 |
-
FROM python:3.
|
| 3 |
-
|
| 4 |
-
# Set working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Install system dependencies (jika ada library yang butuh build tools)
|
| 8 |
-
RUN apt-get update && apt-get install -y \
|
| 9 |
-
build-essential \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
# Copy requirements dan install dependencies
|
| 13 |
-
COPY requirements.txt .
|
| 14 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
-
|
| 16 |
-
# Copy seluruh code ke container
|
| 17 |
-
COPY . .
|
| 18 |
-
|
| 19 |
-
# Buat user non-root (syarat keamanan Hugging Face Spaces)
|
| 20 |
-
RUN useradd -m -u 1000 user
|
| 21 |
-
USER user
|
| 22 |
-
ENV HOME=/home/user \
|
| 23 |
-
PATH=/home/user/.local/bin:$PATH
|
| 24 |
-
|
| 25 |
-
# Expose port (Hugging Face biasanya listen di 7860, tapi kita bisa setting)
|
| 26 |
-
# CMD akan dijalankan oleh HF
|
| 27 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Gunakan image Python yang ringan
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies (jika ada library yang butuh build tools)
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
build-essential \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Copy requirements dan install dependencies
|
| 13 |
+
COPY requirements.txt .
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Copy seluruh code ke container
|
| 17 |
+
COPY . .
|
| 18 |
+
|
| 19 |
+
# Buat user non-root (syarat keamanan Hugging Face Spaces)
|
| 20 |
+
RUN useradd -m -u 1000 user
|
| 21 |
+
USER user
|
| 22 |
+
ENV HOME=/home/user \
|
| 23 |
+
PATH=/home/user/.local/bin:$PATH
|
| 24 |
+
|
| 25 |
+
# Expose port (Hugging Face biasanya listen di 7860, tapi kita bisa setting)
|
| 26 |
+
# CMD akan dijalankan oleh HF
|
| 27 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|