Update Dockerfile
Browse files- Dockerfile +18 -11
Dockerfile
CHANGED
|
@@ -1,19 +1,26 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
# Start the
|
| 19 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
| 1 |
+
# Set working directory
|
| 2 |
+
WORKDIR /app
|
| 3 |
|
| 4 |
+
# Create a writable directory for the cache
|
| 5 |
+
RUN mkdir -p /.cache/huggingface/hub && chmod -R 777 /.cache
|
| 6 |
|
| 7 |
+
# Set the TRANSFORMERS_CACHE environment variable
|
| 8 |
+
ENV TRANSFORMERS_CACHE /.cache/huggingface/hub
|
| 9 |
|
| 10 |
+
# Copy the API files to the container
|
| 11 |
+
COPY main.py .
|
| 12 |
+
COPY gbc.pkl .
|
| 13 |
+
COPY scaler.pkl .
|
| 14 |
|
| 15 |
+
# Upgrade pip
|
| 16 |
+
RUN /usr/local/bin/python -m pip install --upgrade pip
|
| 17 |
|
| 18 |
+
# Install dependencies
|
| 19 |
+
RUN pip install --no-cache-dir fastapi pydantic uvicorn scikit-learn joblib pandas numpy
|
| 20 |
+
|
| 21 |
+
# Expose the API port
|
| 22 |
EXPOSE 7860
|
| 23 |
|
| 24 |
+
# Start the API
|
| 25 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 26 |
+
#CMD ["uvicorn", "main:app", "--host", "127.0.0.1", "--port", "8000"]
|